diff --git a/azurerm/internal/services/applicationinsights/resource_arm_application_insights.go b/azurerm/internal/services/applicationinsights/resource_arm_application_insights.go index e348c038a798..375b5d175ccf 100644 --- a/azurerm/internal/services/applicationinsights/resource_arm_application_insights.go +++ b/azurerm/internal/services/applicationinsights/resource_arm_application_insights.go @@ -85,6 +85,12 @@ func resourceArmApplicationInsights() *schema.Resource { ValidateFunc: validation.FloatBetween(0, 100), }, + "disable_ip_masking": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "tags": tags.Schema(), "daily_data_cap_in_gb": { @@ -141,6 +147,7 @@ func resourceArmApplicationInsightsCreateUpdate(d *schema.ResourceData, meta int applicationType := d.Get("application_type").(string) samplingPercentage := utils.Float(d.Get("sampling_percentage").(float64)) + disableIpMasking := d.Get("disable_ip_masking").(bool) location := azure.NormalizeLocation(d.Get("location").(string)) t := d.Get("tags").(map[string]interface{}) @@ -148,6 +155,7 @@ func resourceArmApplicationInsightsCreateUpdate(d *schema.ResourceData, meta int ApplicationID: &name, ApplicationType: insights.ApplicationType(applicationType), SamplingPercentage: samplingPercentage, + DisableIPMasking: utils.Bool(disableIpMasking), } if v, ok := d.GetOk("retention_in_days"); ok { @@ -243,6 +251,7 @@ func resourceArmApplicationInsightsRead(d *schema.ResourceData, meta interface{} d.Set("app_id", props.AppID) d.Set("instrumentation_key", props.InstrumentationKey) d.Set("sampling_percentage", props.SamplingPercentage) + d.Set("disable_ip_masking", props.DisableIPMasking) if v := props.RetentionInDays; v != nil { d.Set("retention_in_days", v) } diff --git a/azurerm/internal/services/applicationinsights/tests/resource_arm_application_insights_test.go b/azurerm/internal/services/applicationinsights/tests/resource_arm_application_insights_test.go index 22ffbb3053b1..564db6f2c754 100644 --- a/azurerm/internal/services/applicationinsights/tests/resource_arm_application_insights_test.go +++ b/azurerm/internal/services/applicationinsights/tests/resource_arm_application_insights_test.go @@ -315,6 +315,7 @@ resource "azurerm_application_insights" "test" { sampling_percentage = 50 daily_data_cap_in_gb = 50 daily_data_cap_notifications_disabled = true + disable_ip_masking = true tags = { Hello = "World" diff --git a/website/docs/r/application_insights.html.markdown b/website/docs/r/application_insights.html.markdown index c254d880f8e2..8bdbd7103347 100644 --- a/website/docs/r/application_insights.html.markdown +++ b/website/docs/r/application_insights.html.markdown @@ -56,6 +56,8 @@ The following arguments are supported: * `sampling_percentage` - (Optional) Specifies the percentage of the data produced by the monitored application that is sampled for Application Insights telemetry. +* `disable_ip_masking` - (Optional) By default the real client ip is masked as `0.0.0.0` in the logs. Use this argument to disable masking and log the real client ip. Defaults to `false`. + * `tags` - (Optional) A mapping of tags to assign to the resource. ## Attributes Reference