Skip to content

Commit

Permalink
azurerm_application_insights - add disable_ip_masking property (#6354)
Browse files Browse the repository at this point in the history
  • Loading branch information
francescopersico authored Apr 10, 2020
1 parent 699c0ae commit eb33d2a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -141,13 +147,15 @@ 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{})

applicationInsightsComponentProperties := insights.ApplicationInsightsComponentProperties{
ApplicationID: &name,
ApplicationType: insights.ApplicationType(applicationType),
SamplingPercentage: samplingPercentage,
DisableIPMasking: utils.Bool(disableIpMasking),
}

if v, ok := d.GetOk("retention_in_days"); ok {
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/application_insights.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb33d2a

Please sign in to comment.