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

Use suppressdiff on monitor type #247

Merged
merged 1 commit into from
Jun 26, 2019
Merged

Conversation

nmuesch
Copy link
Contributor

@nmuesch nmuesch commented Jun 25, 2019

This PR takes us back to using the suppressDiff function for the case of monitor types being one of metric alert or query alert

The issue with the previous approach was that the diff is calculated based on what the state is refreshed as vs what the config has. Take this example:

User provides metric alert in the config. Runs terraform apply and the API successfully creates the monitor (but the monitor is really a query alert. Future API calls return query alert in the response.
With older monitors (created before Provider 2.0.0), the state contained query alert because the diffsuppress ignored the diff and set the state to contain what the API returned.
With 2.0.0 and 2.0.1, since this suppression was moved into the Read function, the state wasn't updated with the api response, but contained what the config had. This caused (expected) no diff to be created with new monitors, but any old monitor would be recreated.

This should fix #241

@ghost ghost added the size/XS label Jun 25, 2019
Copy link
Contributor

@bkabrda bkabrda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@gzussa
Copy link
Contributor

gzussa commented Jun 26, 2019

A quirk indeed 😄

@nmuesch
Copy link
Contributor Author

nmuesch commented Jun 26, 2019

Thanks for the reviews! I've tested this one manually a few times by manually changing my state to have different types (not sure if we can do that in the testing framework) Based off this I'm going to merge.

@nmuesch nmuesch merged commit d9fb4bc into DataDog:master Jun 26, 2019
@bkabrda bkabrda mentioned this pull request Jul 22, 2019
jbenais pushed a commit to jbenais/terraform-provider-datadog that referenced this pull request Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query/Metric alert type change causing delete+recreate
4 participants