Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"azurerm_spring_cloud_service" - supports property sample_rate #11106

Merged
merged 1 commit into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ func resourceSpringCloudService() *schema.Resource {
Type: schema.TypeString,
Required: true,
},

"sample_rate": {
Type: schema.TypeFloat,
Optional: true,
Default: 10,
ValidateFunc: validation.FloatBetween(0, 100),
},
},
},
},
Expand Down Expand Up @@ -605,6 +612,7 @@ func expandSpringCloudTrace(input []interface{}) *appplatform.MonitoringSettingP
return &appplatform.MonitoringSettingProperties{
TraceEnabled: utils.Bool(true),
AppInsightsInstrumentationKey: utils.String(v["instrumentation_key"].(string)),
AppInsightsSamplingRate: utils.Float(v["sample_rate"].(float64)),
}
}

Expand Down Expand Up @@ -814,12 +822,16 @@ func flattenSpringCloudTrace(input *appplatform.MonitoringSettingProperties) []i

enabled := false
instrumentationKey := ""
samplingRate := 0.0
if input.TraceEnabled != nil {
enabled = *input.TraceEnabled
}
if input.AppInsightsInstrumentationKey != nil {
instrumentationKey = *input.AppInsightsInstrumentationKey
}
if input.AppInsightsSamplingRate != nil {
samplingRate = *input.AppInsightsSamplingRate
}

if !enabled {
return []interface{}{}
Expand All @@ -828,6 +840,7 @@ func flattenSpringCloudTrace(input *appplatform.MonitoringSettingProperties) []i
return []interface{}{
map[string]interface{}{
"instrumentation_key": instrumentationKey,
"sample_rate": samplingRate,
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ resource "azurerm_spring_cloud_service" "test" {

trace {
instrumentation_key = azurerm_application_insights.test.instrumentation_key
sample_rate = 20
}

tags = {
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/spring_cloud_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ resource "azurerm_spring_cloud_service" "example" {

trace {
instrumentation_key = azurerm_application_insights.example.instrumentation_key
sample_rate = 10.0
}

tags = {
Expand Down Expand Up @@ -147,6 +148,8 @@ The `trace` block supports the following:

* `instrumentation_key` - (Required) The Instrumentation Key used for Application Insights.

* `sample_rate` - (Optional) The sampling rate of Application Insights Agent. Must be between `0.0` and `100.0`. Defaults to `10.0`.

## Attributes Reference

The following attributes are exported:
Expand Down