terraform-provider-datadog icon indicating copy to clipboard operation
terraform-provider-datadog copied to clipboard

new_group_delay doesn't override new_host_delay

Open hevcy opened this issue 3 years ago • 10 comments

Terraform Version

1.1.7

Affected Resource(s)

datadog_monitor

Expected Behavior

A terraform plan is carried out with no changes required.

Actual Behavior

Terraform plan produces the following:

~ resource "datadog_monitor" "monitor" {
     id                   = "12345"
     name                 = "somemonitor"
   + new_host_delay       = 300
     tags                 = []
     # (15 unchanged attributes hidden)
     # (1 unchanged block hidden)
  }

Steps to Reproduce

Define a monitor in terraform such as:

resource "datadog_monitor" "monitor" {
  ...
  
  new_group_delay = 60
}

Run a plan.

Important Factoids

The monitor was created manually before being imported into terraform.

hevcy avatar Aug 18 '22 16:08 hevcy

I am facing the same issue. If I specify new_group_delay = 120 only, I end up with a plan that includes:

+ new_group_delay     = 120
+ new_host_delay      = 300

If I try to specify both new_group_delay = 120 and new_host_delay = 0, I get the warning:

Argument is deprecated
(...)
Use `new_group_delay` except when setting `new_host_delay` to zero.

and also the error:

400 Bad Request: {"errors": ["new_host_delay must not be set when new_group_delay is used"]}

My terraform version is 1.2.7

The behaviour that I expect is to set new_group_delay only and get a plan that does not include new_host_delay at all, or if it does include new_host_delay, then that is set to 0. If only setting new_group_delay necessarily will result in new_host_delay being set to 300, then I should be allowed to set new_host_delay to 0, which in fact is what the warning says but which is contradicted by the error.

amanda-wee avatar Aug 24 '22 00:08 amanda-wee

We are facing the same issue right now, which also breaks our "tfmigrate" state import step in our pipeline, since "tfmigrate" is detecting a change in the imported monitor.

Has anyone found a solution for this issue?

fadimilio avatar Jan 18 '24 10:01 fadimilio

I gave #1626 a quick test today … and it seems like it works? (It at least causes plan to converge.) Was there a reason it was closed?

roy-work avatar Apr 25 '24 19:04 roy-work

This bug still reproduces. I tried this with DataDog/datadog version 3.39.0.
I imported a monitor resource that has new_group_delay=60, and new_host_delay not even set. But when I do a terraform plan, it shows that it wants to force a new_host_delay=300.

darkn3rd avatar Jun 23 '24 19:06 darkn3rd