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

[Tracking Issue] Order is lost in JSON/policies when applied #21968

Closed
67 tasks done
YakDriver opened this issue Nov 30, 2021 · 2 comments · Fixed by #22259
Closed
67 tasks done

[Tracking Issue] Order is lost in JSON/policies when applied #21968

YakDriver opened this issue Nov 30, 2021 · 2 comments · Fixed by #22259
Assignees
Labels
bug Addresses a defect in current functionality.
Milestone

Comments

@YakDriver
Copy link
Member

YakDriver commented Nov 30, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Relates #22048

Centralized JSON List/Array Diff Issue

When Terraform reports a spurious diff, it can be inconvenient. If that non-diff forces replacement, it can seriously affect systems. We don't want that.

This issue focues on AWS provider non-diffs occurring on AWS policy JSONs. It is looking at the problem, tracking fixes, and gathering references.

Diffs vs. Reordering vs. Preserving Order vs. Ignoring Order

Assuming that non-diff diffs (i.e., spurious diffs) are the crux of the problem, consistent reordering (such as alphabetical or anti-alphabetical as with #6107), preserving the given order, or completely ignoring order within JSON arrays can all be solutions. Many times issues suggest some variation of ordering but the bottom-line reason seems to be avoiding diffs.

Step 1

In this round of fixes, the approach is to ignore order by only setting a new policy JSON when it is not equivalent to the existing policy JSON. The data source aws_iam_policy_document takes a different approach by reordering the JSON arrays, currently anti-alphabetically (see #6107).

Companion Issue to #11801

Perhaps the most popular issue to describe these problems is #11801. Rather than hijack it, this is a generalized issue and central place for documenting similar problems and tracking fixes.

Fixes Needed

References

Provider References

Other References

@YakDriver YakDriver added enhancement Requests to existing resources that expand the functionality or scope. bug Addresses a defect in current functionality. and removed enhancement Requests to existing resources that expand the functionality or scope. labels Nov 30, 2021
@github-actions github-actions bot removed the bug Addresses a defect in current functionality. label Nov 30, 2021
@YakDriver YakDriver added this to the Roadmap milestone Nov 30, 2021
@YakDriver YakDriver self-assigned this Nov 30, 2021
@YakDriver YakDriver changed the title [Tracking Issue] Order is lost for data aws_iam_policy_document when applied [Tracking Issue] Order is lost in JSON for aws_iam_policy_document when applied Nov 30, 2021
@YakDriver YakDriver changed the title [Tracking Issue] Order is lost in JSON for aws_iam_policy_document when applied [Tracking Issue] Order is lost in JSON/policies when applied Dec 2, 2021
@YakDriver YakDriver added the bug Addresses a defect in current functionality. label Dec 2, 2021
@github-actions
Copy link

This functionality has been released in v3.70.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant