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

[bug] Deleting monitors that are part of an SLO fails #439

Closed
Towerthousand opened this issue Mar 9, 2020 · 5 comments
Closed

[bug] Deleting monitors that are part of an SLO fails #439

Towerthousand opened this issue Mar 9, 2020 · 5 comments
Assignees

Comments

@Towerthousand
Copy link

Hey!

Declaring a monitor and using it in a declared SLO and then removing the monitor (also removing it from the SLO in the same apply, of course) fails with an API error. There should be a check to remove it from all SLOs first or to remove it from the SLO automatically on deletion.

Happy to open a PR if pointed in the right direction. Thanks!

Terraform Version

Terraform v0.12.23
+ provider.datadog v2.7.0

Affected Resource(s)

  • datadog_monitor
  • datadog_service_level_objective

Terraform Configuration Files

Version 1:

datadog_monitor "this" {
  [...]
}
datadog_monitor "that" {
  [...]
}

resource datadog_service_level_objective "overrall_slo" {
  type = "monitor"
  monitor_ids = [datadog_monitor.this.id, datadog_monitor.that.id]
  [...]
}

Version 2:

datadog_monitor "this" {
  [...]
}

resource datadog_service_level_objective "overrall_slo" {
  type = "monitor"
  monitor_ids = [datadog_monitor.this.id]
  [...]
}

Debug Output

Error: API error 401 Unauthorized: {"errors":["monitor [16195606,test monitor 'this'] is referenced in slos: [34dbd856b8c8591dae09f9db0458adb2,test slo]"]}

Expected Behavior

Apply runs without errors

Actual Behavior

Apply errored with a 401, monitors and SLO untouched.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply with V1
  2. terraform apply with V2
@Towerthousand
Copy link
Author

Datadog API explicitly supports the force flag for this, but the go client does not support it

@Towerthousand
Copy link
Author

I opened a PR on the go client: zorkian/go-datadog-api#311

@nmuesch
Copy link
Contributor

nmuesch commented Mar 16, 2020

Hey @Towerthousand Thanks for the report and the pull request to the go client. Would you be interested in working on adding this to the terraform provider?

@bkabrda updated the vendored go client in this provider that includes your change - https://github.com/terraform-providers/terraform-provider-datadog/pull/447/files

@Towerthousand
Copy link
Author

Hey! adding a PR :)

@Towerthousand
Copy link
Author

fixed in #535

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