Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR takes us back to using the
suppressDiff
function for the case of monitor types being one ofmetric alert
orquery 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 aquery alert
. Future API calls returnquery 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