Skip to content

Commit

Permalink
Don't ignore options diff in synthetics resource (#707)
Browse files Browse the repository at this point in the history
We ignore the diff completely when options_list is set, which sounds
like unwanted behavior.

Closes #697

* Add a test

* Update an existing test instead
  • Loading branch information
therve authored Oct 19, 2020
1 parent 180aa61 commit f1386e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 0 additions & 5 deletions datadog/resource_datadog_synthetics_test_.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,6 @@ func syntheticsTestOptions() *schema.Schema {
ConflictsWith: []string{"options_list"},
Deprecated: "This parameter is deprecated, please use `options_list`",
DiffSuppressFunc: func(key, old, new string, d *schema.ResourceData) bool {
// DiffSuppressFunc is useless if options_list exists
if _, isOptionsV2 := d.GetOk("options_list"); isOptionsV2 {
return isOptionsV2
}

if key == "options.follow_redirects" || key == "options.accept_self_signed" || key == "options.allow_insecure" {
// TF nested schemas is limited to string values only
// follow_redirects, accept_self_signed and allow_insecure being booleans in Datadog json api
Expand Down
6 changes: 6 additions & 0 deletions datadog/resource_datadog_synthetics_test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ func createSyntheticsAPITestStep(accProvider *schema.Provider, clock clockwork.F
"datadog_synthetics_test.foo", "options.min_location_failed", "1"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.foo", "options.retry_count", "1"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.foo", "options_list.#", "0"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.foo", "name", testName),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -668,6 +670,8 @@ func updateSyntheticsAPITestStep(accProvider *schema.Provider, clock clockwork.F
"datadog_synthetics_test.foo", "options_list.0.retry.0.interval", "500"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.foo", "options_list.0.monitor_options.0.renotify_interval", "100"),
// Make sure the legacy attribute isn't set anymore
resource.TestCheckNoResourceAttr("datadog_synthetics_test.foo", "options.tick_every"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.foo", "name", testName),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -1030,6 +1034,8 @@ func createSyntheticsTCPTestStep(accProvider *schema.Provider, clock clockwork.F
"datadog_synthetics_test.tcp", "locations.0", "aws:eu-central-1"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.tcp", "options_list.0.tick_every", "60"),
// Make sure the legacy attribute isn't set anymore
resource.TestCheckNoResourceAttr("datadog_synthetics_test.tcp", "options.tick_every"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.tcp", "name", testName),
resource.TestCheckResourceAttr(
Expand Down

0 comments on commit f1386e9

Please sign in to comment.