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

Sort datadog_downtime monitor tags to avoid plan diffs #540

Merged

Conversation

jurajseffer
Copy link
Contributor

Once an unsorted list of monitor_tags is applied for datadog_downtime, Terraform shows a permanent diff because Datadog API responds with an ordered list.

This PR builds on https://github.com/terraform-providers/terraform-provider-datadog/pull/214 by changing the type from list to set and applying ordering. I've extended the tests with additional values and replayed cassettes. The fix appears to work using a binary for my use case.

@ghost ghost added the size/XXL label Jun 15, 2020
Copy link
Contributor

@gzussa gzussa left a comment

Choose a reason for hiding this comment

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

Thanks for this PR 💯 . I have couple of questions. See my comments 😄

datadog/resource_datadog_downtime.go Show resolved Hide resolved
datadog/resource_datadog_downtime_test.go Show resolved Hide resolved
tags = append(tags, mt.(string))
}
sort.Strings(tags)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we still need to sort them if we are using schema.TypeSet [1] ?

--
[1] https://www.terraform.io/docs/extend/schemas/schema-types.html#typeset

@jirikuncar jirikuncar added the bug label Jul 15, 2020
@jirikuncar
Copy link
Contributor

Addresses #577

@jirikuncar jirikuncar linked an issue Jul 17, 2020 that may be closed by this pull request
@jirikuncar jirikuncar requested a review from therve July 21, 2020 16:26
@jirikuncar jirikuncar merged commit 8cf1dc9 into DataDog:master Jul 21, 2020
@jurajseffer
Copy link
Contributor Author

Thanks for cleaning it up @jirikuncar and merging 🥇

@jurajseffer jurajseffer deleted the datadog_downtime_monitor_tags_sorting branch July 21, 2020 16:32
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.

Bug: Resource datadog_downtime change every time
4 participants