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

[datadog_monitor_json] Fix erroneous drift on restriction_policy field #2767

Closed
wants to merge 2 commits into from

Conversation

ecdatadog
Copy link

Closes #2515

The /api/v1/monitor/{id} doesn't returns the restriction_policies by default so if the user requests some, there is some unexpected drift.

With this PR, we are requesting the restriction_policy field if it is defined in the json submitted by the user.

// Restriction policies are not returned in the API response by default
// In order to prevent some erroneous drift, we return it (and take in account in the state)
// if the user requests some restriction policy (behavior similar to Optional Computed)
if _, ok := attrMap["restriction_policy"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

in addition to concern Phillip raised, couple of things to consider here

  • if restricted_roles exist, we should not return restriction policy and vice versa
  • we perform sorting on the restriction policy value that is returned, so you would have to take that into consideration as that may not be the same order in which the user defined restriction policy in their terraform file

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.

Erroneous update-in-place on datadog_monitor_json with restriction policy
2 participants