Skip to content

Commit

Permalink
[Synthetics] Add suppressDiffFunc for rum settings when local state i…
Browse files Browse the repository at this point in the history
…s nil and remote is false
  • Loading branch information
bhaoui committed Aug 18, 2022
1 parent 76401f2 commit ba91ed0
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 0 deletions.
17 changes: 17 additions & 0 deletions datadog/resource_datadog_synthetics_test_.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,23 @@ func syntheticsTestOptionsList() *schema.Schema {
Description: "The RUM data collection settings for the Synthetic browser test.",
Type: schema.TypeList,
MaxItems: 1,
DiffSuppressFunc: func(key, old, new string, d *schema.ResourceData) bool {
if strings.Contains(key, "is_enabled") {
if new != "true" && old != "true" {
return true
}
} else {
if rum_settings, ok := d.GetOk("options_list.0.rum_settings.0"); ok {
settings := rum_settings.(map[string]interface{})
isEnabled := settings["is_enabled"]

if !isEnabled.(bool) {
return true
}
}
}
return false
},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"is_enabled": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2022-08-18T17:25:46.567983+02:00
Loading

0 comments on commit ba91ed0

Please sign in to comment.