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

Support for composite monitor update/delete order and force delete #519

Closed
vish91 opened this issue May 28, 2020 · 3 comments · Fixed by #535
Closed

Support for composite monitor update/delete order and force delete #519

vish91 opened this issue May 28, 2020 · 3 comments · Fixed by #535

Comments

@vish91
Copy link

vish91 commented May 28, 2020

Terraform Version

Terraform v0.12.26

  • provider.datadog v2.7.0

Affected Resource(s)

  • datadog_monitors

Debug Output

Expected Behavior

Given a terraform plan with an update to a composite monitor and a delete for individual monitor used by that composite monitor.
It should be able to successfully delete the individual monitor and update the composite monitor to not use that deleted monitor.

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place
  - destroy

Actual Behavior

Since composite monitor is still using a reference to the monitor ID that we are trying to delete it fails the terraform apply altogether.

  1. No way to order the steps to make sure it updates the composite monitor before deleting inidividual monitor
  2. No way to force delete a monitor using terraform like we can from the API or other sdks.
    https://docs.datadoghq.com/api/v1/monitors/#delete-a-monitor
Error: 400 Bad Request: {"errors":["Monitor is part of the following composite monitors] .....

Error: API error 401 Unauthorized: {"errors":["monitor [xxxxYYYY, [monitor-A] is referenced in monitor-B]"]}
@ykyr
Copy link

ykyr commented Jun 2, 2020

I have exact same issue.
However, even-though datadog_monitor is missing such an attribute, I think this is datadog side issue.

I'm not able to force delete the monitor via API:
curl -X DELETE "https://api.datadoghq.com/api/v1/monitor/${monitor_id}?force=true&api_key=${api_key}&application_key=${app_key}"

{"errors":["Monitor is part of the following composite monitors: Test composite"]}

Documentation with force=True was added in this MR DataDog/documentation#6595

@ykyr
Copy link

ykyr commented Jun 11, 2020

After communication with Datadog support, their engineering team fixed the API.
I opened a pull request to add force_delete parameter to datadog_monitor resource.

@vish91
Copy link
Author

vish91 commented Jun 19, 2020

@ykyr thanks for your help and fixing this.

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

Successfully merging a pull request may close this issue.

2 participants