Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downtime change to start should recreate the resource #2798

Open
robinlioret opened this issue Jan 23, 2025 · 1 comment
Open

Downtime change to start should recreate the resource #2798

robinlioret opened this issue Jan 23, 2025 · 1 comment

Comments

@robinlioret
Copy link

robinlioret commented Jan 23, 2025

Datadog Terraform Provider Version

v3.52.1

Terraform Version

v1.10.5

What resources or data sources are affected?

datadog_downtime_schedule

Terraform Configuration Files

# Test monitor
resource "datadog_monitor" "foo" {
  name               = "ISSUE_DOWNTIME_TEST"
  type               = "metric alert"
  message            = ""
  query = "avg(last_1h):avg:aws.ec2.cpu{environment:foo,host:foo} by {host} > 4"
  monitor_thresholds {
    critical = 4
  }
}

# Downtime with dynamic start (only for easy reproduction of the issue)
resource "datadog_downtime_schedule" "downtime_schedule_example" {
  scope = "*"
  monitor_identifier {
    monitor_id = datadog_monitor.foo.id
  }
  one_time_schedule {
    start =  timestamp()
    end =  timeadd(timestamp(), "1h")
  }
}

Relevant debug or panic output

When start and end time changes while the downtime is active, if we try to change the start time we'll have the following error message:

400 Bad Request: {"errors":["Start times of downtimes in progress cannot be
changed"]}

Expected Behavior

Trigger a replacement.

A replacement may cause issue in some context where replacement is not desired. May be an option to enable replacement for this field.

Actual Behavior

Fails with a 400 error.

Steps to Reproduce

  1. Copy and adapt the code snippet provided
  2. Run terraform apply
  3. Wait at least one minute
  4. Run terraform apply

Important Factoids

No response

References

No response

@ItsMeMarty
Copy link

+1 to this issue. We are seeing the same thing in our project.

We use a local variable that updates the downtime schedule start time which causes this exact same issue where the resource fails due because a downtime cannot be updated while in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants