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

[datadog_downtime_schedule] Add support for Downtime V2 #2023

Merged
merged 22 commits into from
Aug 1, 2023

Conversation

carlmartensen
Copy link
Contributor

@carlmartensen carlmartensen commented Jul 21, 2023

Implements the new datadog_downtime_schedule resource that wires the Downtime v2 API into the Datadog terraform provider. This resource is similar to the soon-to-be deprecated datadog_downtime except that it supports multiple recurrences and granular scope queries

Example:

resource "datadog_downtime_schedule" "downtime_schedule_example" {
  scope = "env:us9-prod7 AND team:test123"
  monitor_identifier {
    monitor_tags = ["test:123", "data:test"]
  }
  
  recurring_schedule {
    recurrence {
      duration = "1h"
      rrule    = "FREQ=DAILY;INTERVAL=1"
      start    = "2050-01-02T03:04:05"
    }
    recurrence {
      duration = "1d"
      rrule    = "FREQ=WEEKLY;INTERVAL=1"
      start    = "3050-01-02T03:04:05"
    }
    timezone = "America/New_York"
  }
  
  # one_time_schedule {
  #  start = null
  #  end = "2050-01-02T03:04:05Z"
  # }
  
  display_timezone                 = "America/New_York"
  message                          = "Message about the downtime"
  mute_first_recovery_notification = true
  notify_end_states                = ["alert", "warn"]
  notify_end_types                 = ["canceled", "expired"]
}

@carlmartensen carlmartensen requested review from a team as code owners July 21, 2023 22:14
@carlmartensen carlmartensen marked this pull request as draft July 21, 2023 22:14
@carlmartensen carlmartensen changed the title Carl/downtime schedule Add downtime_schedule resource Jul 22, 2023
@carlmartensen carlmartensen force-pushed the carl/downtime-schedule branch from aa3c275 to f5a6b7d Compare July 24, 2023 17:35
@carlmartensen carlmartensen force-pushed the carl/downtime-schedule branch from f5a6b7d to d9a2f3d Compare July 24, 2023 18:15
@carlmartensen carlmartensen force-pushed the carl/downtime-schedule branch from d9a2f3d to e9569e0 Compare July 24, 2023 18:33
@carlmartensen carlmartensen changed the title Add downtime_schedule resource Add datadog_downtime_schedule resource Jul 24, 2023
@carlmartensen carlmartensen marked this pull request as ready for review July 24, 2023 19:08
@carlmartensen carlmartensen changed the title Add datadog_downtime_schedule resource [datadog_downtime_schedule] Add datadog_downtime_schedule resource Jul 24, 2023
@carlmartensen carlmartensen changed the title [datadog_downtime_schedule] Add datadog_downtime_schedule resource [datadog_downtime_schedule] Add new resource Jul 24, 2023
@carlmartensen carlmartensen changed the title [datadog_downtime_schedule] Add new resource [datadog_downtime_schedule] Add support for Downtime V2 Jul 24, 2023
@nkzou nkzou requested a review from a team July 24, 2023 20:14
urseberry
urseberry previously approved these changes Jul 24, 2023
@carlmartensen carlmartensen force-pushed the carl/downtime-schedule branch from c12e6ab to 12d2d03 Compare July 25, 2023 17:28
@carlmartensen carlmartensen requested a review from a team as a code owner July 26, 2023 17:36
nkzou
nkzou previously approved these changes Jul 27, 2023
@carlmartensen carlmartensen force-pushed the carl/downtime-schedule branch from d8a10e2 to 2edf630 Compare July 27, 2023 17:37
@nkzou nkzou merged commit ece34c3 into master Aug 1, 2023
@nkzou nkzou deleted the carl/downtime-schedule branch August 1, 2023 19:38
@Veske
Copy link

Veske commented Feb 29, 2024

@carlmartensen
What is the recommendation for an indefinite downtime declaration when using this new API?

The provider requires us to specify at least one type of schedule:

Error: one_time_schedule or recurring_schedule must be set

We opted for specifying the one_time_schedule as one_time_schedule: {} but this is causing issues for recurrent runs of the same Terraform project with the following error:

Start time of downtimes in progress cannot be changed

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

Successfully merging this pull request may close these issues.

5 participants