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

fix: Ignore order of client IDs in iam_openid_connect_provider #31253

Conversation

Antvirf
Copy link
Contributor

@Antvirf Antvirf commented May 8, 2023

Description

When creating an aws_iam_openid_connect_provider today, AWS does not seem to preserve the order of values provided in client_id_list. Functionally this is not a problem, but it does lead to #29868 where subsequent applies will lead to non-empty plans, as Terraform attempts to 'correct' the order (unless the order given in your .tf file happens to match AWS).

This PR addresses that by defining a new DiffSuppressFunc for this use case, which suppresses a diff if a 'new' element is found in the list of client_ids present on the current state. As long as your changes only affect the order, there will be no diff and therefore no plan. It should be noted though that once you do change somethign else than the order (i.e. add/remove client ids), the shown diff will still show that Terraform is attempting to change the order.

Should the implementation on AWS side change, this addition will not break (though it will of course be made redundant).

Relations

Relates to #29868 - please help comment if this should 'close' the issue as well. I originally stumbled on this issue when using the terraform-aws-oidc-github module (see relevant issue).

References

N/A

Output from Acceptance Testing

$ make testacc TESTS=TestAccIAMOpenidConnectProvider_clientIdListOrder PKG=iam
...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMOpenidConnectProvider_clientIdListOrder'  -timeout 180m
=== RUN   TestAccIAMOpenidConnectProvider_clientIdListOrder
=== PAUSE TestAccIAMOpenidConnectProvider_clientIdListOrder
=== CONT  TestAccIAMOpenidConnectProvider_clientIdListOrder
--- PASS: TestAccIAMOpenidConnectProvider_clientIdListOrder (28.10s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/iam        30.259s


@github-actions
Copy link

github-actions bot commented May 8, 2023

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added service/iam Issues and PRs that pertain to the iam service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels May 8, 2023
@Antvirf Antvirf marked this pull request as ready for review May 8, 2023 07:49
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 8, 2023
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccIAMOpenIDConnectProvider_' PKG=iam ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 3  -run=TestAccIAMOpenIDConnectProvider_ -timeout 180m
=== RUN   TestAccIAMOpenIDConnectProvider_basic
=== PAUSE TestAccIAMOpenIDConnectProvider_basic
=== RUN   TestAccIAMOpenIDConnectProvider_tags
=== PAUSE TestAccIAMOpenIDConnectProvider_tags
=== RUN   TestAccIAMOpenIDConnectProvider_disappears
=== PAUSE TestAccIAMOpenIDConnectProvider_disappears
=== RUN   TestAccIAMOpenIDConnectProvider_clientIdListOrder
=== PAUSE TestAccIAMOpenIDConnectProvider_clientIdListOrder
=== CONT  TestAccIAMOpenIDConnectProvider_basic
=== CONT  TestAccIAMOpenIDConnectProvider_disappears
=== CONT  TestAccIAMOpenIDConnectProvider_clientIdListOrder
--- PASS: TestAccIAMOpenIDConnectProvider_disappears (13.01s)
=== CONT  TestAccIAMOpenIDConnectProvider_tags
--- PASS: TestAccIAMOpenIDConnectProvider_clientIdListOrder (21.04s)
--- PASS: TestAccIAMOpenIDConnectProvider_basic (27.30s)
--- PASS: TestAccIAMOpenIDConnectProvider_tags (34.64s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iam	53.194s

@ewbankkit
Copy link
Contributor

ewbankkit commented May 8, 2023

@Antvirf Thanks for the contribution 🎉 👏.
This can be simplified by changing the attribute from TypeList to TypeSet.

@ewbankkit ewbankkit merged commit 7e4ffbe into hashicorp:main May 8, 2023
@github-actions github-actions bot added this to the v4.67.0 milestone May 8, 2023
@github-actions
Copy link

This functionality has been released in v4.67.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!

@jBouyoud
Copy link
Contributor

👋 Just for the notice, this is a breaking change for users that are using this output as a list.

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 Jun 16, 2023
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. service/iam Issues and PRs that pertain to the iam service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants