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

iam: Improve policy diff handling #28836

Merged
merged 4 commits into from
Jan 12, 2023
Merged

iam: Improve policy diff handling #28836

merged 4 commits into from
Jan 12, 2023

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Jan 11, 2023

Description

Based on new changes and improvements, I haven't been able to reproduce the problems noted in #28833 and #28835. I've added acceptance tests specifically to test the examples given that are now passing.

In #23288, I am not able to reproduce the issues noted there. For anything that I'm not addressing, I created new issues.

Relations

Closes #28833
Closes #28835
Closes #23288

References

Output from Acceptance Testing

% make testacc TESTS=TestAccIAMGroupPolicy_ PKG=iam
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMGroupPolicy_'  -timeout 180m
=== RUN   TestAccIAMGroupPolicy_basic
=== PAUSE TestAccIAMGroupPolicy_basic
=== RUN   TestAccIAMGroupPolicy_disappears
=== PAUSE TestAccIAMGroupPolicy_disappears
=== RUN   TestAccIAMGroupPolicy_namePrefix
=== PAUSE TestAccIAMGroupPolicy_namePrefix
=== RUN   TestAccIAMGroupPolicy_generatedName
=== PAUSE TestAccIAMGroupPolicy_generatedName
=== CONT  TestAccIAMGroupPolicy_basic
=== CONT  TestAccIAMGroupPolicy_namePrefix
=== CONT  TestAccIAMGroupPolicy_disappears
=== CONT  TestAccIAMGroupPolicy_generatedName
--- PASS: TestAccIAMGroupPolicy_disappears (16.15s)
--- PASS: TestAccIAMGroupPolicy_namePrefix (28.89s)
--- PASS: TestAccIAMGroupPolicy_generatedName (29.17s)
--- PASS: TestAccIAMGroupPolicy_basic (31.57s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iam	33.825s
% make testacc TESTS=TestAccIAMPolicy_ PKG=iam
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMPolicy_'  -timeout 180m
=== RUN   TestAccIAMPolicy_basic
=== PAUSE TestAccIAMPolicy_basic
=== RUN   TestAccIAMPolicy_description
=== PAUSE TestAccIAMPolicy_description
=== RUN   TestAccIAMPolicy_tags
=== PAUSE TestAccIAMPolicy_tags
=== RUN   TestAccIAMPolicy_disappears
=== PAUSE TestAccIAMPolicy_disappears
=== RUN   TestAccIAMPolicy_namePrefix
=== PAUSE TestAccIAMPolicy_namePrefix
=== RUN   TestAccIAMPolicy_path
=== PAUSE TestAccIAMPolicy_path
=== RUN   TestAccIAMPolicy_policy
=== PAUSE TestAccIAMPolicy_policy
=== RUN   TestAccIAMPolicy_diffs
=== PAUSE TestAccIAMPolicy_diffs
=== CONT  TestAccIAMPolicy_basic
=== CONT  TestAccIAMPolicy_namePrefix
=== CONT  TestAccIAMPolicy_tags
=== CONT  TestAccIAMPolicy_description
=== CONT  TestAccIAMPolicy_policy
=== CONT  TestAccIAMPolicy_path
=== CONT  TestAccIAMPolicy_diffs
=== CONT  TestAccIAMPolicy_disappears
--- PASS: TestAccIAMPolicy_disappears (18.55s)
--- PASS: TestAccIAMPolicy_path (24.76s)
--- PASS: TestAccIAMPolicy_description (24.80s)
--- PASS: TestAccIAMPolicy_namePrefix (24.81s)
--- PASS: TestAccIAMPolicy_basic (24.96s)
--- PASS: TestAccIAMPolicy_policy (36.49s)
--- PASS: TestAccIAMPolicy_tags (46.92s)
--- PASS: TestAccIAMPolicy_diffs (121.01s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iam	122.663s
% make testacc TESTS=TestAccIAMRole_ PKG=iam
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMRole_'  -timeout 180m
=== RUN   TestAccIAMRole_basic
=== PAUSE TestAccIAMRole_basic
=== RUN   TestAccIAMRole_description
=== PAUSE TestAccIAMRole_description
=== RUN   TestAccIAMRole_nameGenerated
=== PAUSE TestAccIAMRole_nameGenerated
=== RUN   TestAccIAMRole_namePrefix
=== PAUSE TestAccIAMRole_namePrefix
=== RUN   TestAccIAMRole_testNameChange
=== PAUSE TestAccIAMRole_testNameChange
=== RUN   TestAccIAMRole_diffs
=== PAUSE TestAccIAMRole_diffs
=== RUN   TestAccIAMRole_diffsCondition
=== PAUSE TestAccIAMRole_diffsCondition
=== RUN   TestAccIAMRole_badJSON
=== PAUSE TestAccIAMRole_badJSON
=== RUN   TestAccIAMRole_disappears
=== PAUSE TestAccIAMRole_disappears
=== RUN   TestAccIAMRole_policiesForceDetach
=== PAUSE TestAccIAMRole_policiesForceDetach
=== RUN   TestAccIAMRole_maxSessionDuration
=== PAUSE TestAccIAMRole_maxSessionDuration
=== RUN   TestAccIAMRole_permissionsBoundary
=== PAUSE TestAccIAMRole_permissionsBoundary
=== RUN   TestAccIAMRole_tags
=== PAUSE TestAccIAMRole_tags
=== RUN   TestAccIAMRole_InlinePolicy_basic
=== PAUSE TestAccIAMRole_InlinePolicy_basic
=== RUN   TestAccIAMRole_InlinePolicy_ignoreOrder
=== PAUSE TestAccIAMRole_InlinePolicy_ignoreOrder
=== RUN   TestAccIAMRole_InlinePolicy_empty
=== PAUSE TestAccIAMRole_InlinePolicy_empty
=== RUN   TestAccIAMRole_ManagedPolicy_basic
=== PAUSE TestAccIAMRole_ManagedPolicy_basic
=== RUN   TestAccIAMRole_ManagedPolicy_outOfBandRemovalAddedBack
=== PAUSE TestAccIAMRole_ManagedPolicy_outOfBandRemovalAddedBack
=== RUN   TestAccIAMRole_InlinePolicy_outOfBandRemovalAddedBack
=== PAUSE TestAccIAMRole_InlinePolicy_outOfBandRemovalAddedBack
=== RUN   TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemoved
=== PAUSE TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemoved
=== RUN   TestAccIAMRole_InlinePolicy_outOfBandAdditionRemoved
=== PAUSE TestAccIAMRole_InlinePolicy_outOfBandAdditionRemoved
=== RUN   TestAccIAMRole_InlinePolicy_outOfBandAdditionIgnored
=== PAUSE TestAccIAMRole_InlinePolicy_outOfBandAdditionIgnored
=== RUN   TestAccIAMRole_ManagedPolicy_outOfBandAdditionIgnored
=== PAUSE TestAccIAMRole_ManagedPolicy_outOfBandAdditionIgnored
=== RUN   TestAccIAMRole_InlinePolicy_outOfBandAdditionRemovedEmpty
=== PAUSE TestAccIAMRole_InlinePolicy_outOfBandAdditionRemovedEmpty
=== RUN   TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemovedEmpty
=== PAUSE TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemovedEmpty
=== CONT  TestAccIAMRole_basic
=== CONT  TestAccIAMRole_InlinePolicy_basic
=== CONT  TestAccIAMRole_diffsCondition
=== CONT  TestAccIAMRole_nameGenerated
=== CONT  TestAccIAMRole_badJSON
=== CONT  TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemoved
=== CONT  TestAccIAMRole_testNameChange
=== CONT  TestAccIAMRole_tags
=== CONT  TestAccIAMRole_permissionsBoundary
=== CONT  TestAccIAMRole_maxSessionDuration
=== CONT  TestAccIAMRole_policiesForceDetach
=== CONT  TestAccIAMRole_disappears
=== CONT  TestAccIAMRole_diffs
=== CONT  TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemovedEmpty
=== CONT  TestAccIAMRole_InlinePolicy_outOfBandAdditionRemovedEmpty
=== CONT  TestAccIAMRole_ManagedPolicy_outOfBandAdditionIgnored
=== CONT  TestAccIAMRole_InlinePolicy_outOfBandAdditionIgnored
=== CONT  TestAccIAMRole_InlinePolicy_outOfBandAdditionRemoved
=== CONT  TestAccIAMRole_ManagedPolicy_basic
=== CONT  TestAccIAMRole_InlinePolicy_outOfBandRemovalAddedBack
--- PASS: TestAccIAMRole_badJSON (7.54s)
=== CONT  TestAccIAMRole_ManagedPolicy_outOfBandRemovalAddedBack
--- PASS: TestAccIAMRole_disappears (53.62s)
=== CONT  TestAccIAMRole_namePrefix
--- PASS: TestAccIAMRole_basic (68.87s)
=== CONT  TestAccIAMRole_description
--- PASS: TestAccIAMRole_nameGenerated (69.54s)
=== CONT  TestAccIAMRole_InlinePolicy_empty
--- PASS: TestAccIAMRole_policiesForceDetach (73.13s)
=== CONT  TestAccIAMRole_InlinePolicy_ignoreOrder
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionIgnored (98.94s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandRemovalAddedBack (104.64s)
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemovedEmpty (105.84s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionRemoved (107.01s)
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandRemovalAddedBack (99.67s)
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemoved (107.68s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionRemovedEmpty (107.68s)
--- PASS: TestAccIAMRole_testNameChange (111.80s)
--- PASS: TestAccIAMRole_tags (113.49s)
--- PASS: TestAccIAMRole_namePrefix (63.61s)
--- PASS: TestAccIAMRole_InlinePolicy_empty (50.05s)
--- PASS: TestAccIAMRole_maxSessionDuration (120.66s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionIgnored (127.05s)
--- PASS: TestAccIAMRole_InlinePolicy_basic (130.77s)
--- PASS: TestAccIAMRole_ManagedPolicy_basic (134.92s)
--- PASS: TestAccIAMRole_InlinePolicy_ignoreOrder (80.23s)
--- PASS: TestAccIAMRole_description (87.08s)
--- PASS: TestAccIAMRole_diffsCondition (162.12s)
--- PASS: TestAccIAMRole_permissionsBoundary (163.85s)
--- PASS: TestAccIAMRole_diffs (330.42s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iam	335.228s
% make testacc TESTS=TestAccIAMRolePolicy_ PKG=iam
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMRolePolicy_'  -timeout 180m
=== RUN   TestAccIAMRolePolicy_basic
=== PAUSE TestAccIAMRolePolicy_basic
=== RUN   TestAccIAMRolePolicy_disappears
=== PAUSE TestAccIAMRolePolicy_disappears
=== RUN   TestAccIAMRolePolicy_policyOrder
=== PAUSE TestAccIAMRolePolicy_policyOrder
=== RUN   TestAccIAMRolePolicy_namePrefix
=== PAUSE TestAccIAMRolePolicy_namePrefix
=== RUN   TestAccIAMRolePolicy_generatedName
=== PAUSE TestAccIAMRolePolicy_generatedName
=== RUN   TestAccIAMRolePolicy_invalidJSON
=== PAUSE TestAccIAMRolePolicy_invalidJSON
=== RUN   TestAccIAMRolePolicy_Policy_invalidResource
=== PAUSE TestAccIAMRolePolicy_Policy_invalidResource
=== CONT  TestAccIAMRolePolicy_basic
=== CONT  TestAccIAMRolePolicy_generatedName
=== CONT  TestAccIAMRolePolicy_policyOrder
=== CONT  TestAccIAMRolePolicy_namePrefix
=== CONT  TestAccIAMRolePolicy_disappears
=== CONT  TestAccIAMRolePolicy_Policy_invalidResource
=== CONT  TestAccIAMRolePolicy_invalidJSON
--- PASS: TestAccIAMRolePolicy_invalidJSON (2.36s)
--- PASS: TestAccIAMRolePolicy_Policy_invalidResource (11.21s)
--- PASS: TestAccIAMRolePolicy_disappears (18.62s)
--- PASS: TestAccIAMRolePolicy_policyOrder (25.90s)
--- PASS: TestAccIAMRolePolicy_namePrefix (32.77s)
--- PASS: TestAccIAMRolePolicy_generatedName (33.92s)
--- PASS: TestAccIAMRolePolicy_basic (33.94s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iam	35.724s
% make testacc TESTS=TestAccIAMUserPolicy_ PKG=iam
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMUserPolicy_'  -timeout 180m
=== RUN   TestAccIAMUserPolicy_basic
=== PAUSE TestAccIAMUserPolicy_basic
=== RUN   TestAccIAMUserPolicy_disappears
=== PAUSE TestAccIAMUserPolicy_disappears
=== RUN   TestAccIAMUserPolicy_namePrefix
=== PAUSE TestAccIAMUserPolicy_namePrefix
=== RUN   TestAccIAMUserPolicy_generatedName
=== PAUSE TestAccIAMUserPolicy_generatedName
=== RUN   TestAccIAMUserPolicy_multiplePolicies
=== PAUSE TestAccIAMUserPolicy_multiplePolicies
=== RUN   TestAccIAMUserPolicy_policyOrder
=== PAUSE TestAccIAMUserPolicy_policyOrder
=== CONT  TestAccIAMUserPolicy_basic
=== CONT  TestAccIAMUserPolicy_generatedName
=== CONT  TestAccIAMUserPolicy_multiplePolicies
=== CONT  TestAccIAMUserPolicy_policyOrder
=== CONT  TestAccIAMUserPolicy_disappears
=== CONT  TestAccIAMUserPolicy_namePrefix
--- PASS: TestAccIAMUserPolicy_disappears (18.03s)
--- PASS: TestAccIAMUserPolicy_policyOrder (25.42s)
--- PASS: TestAccIAMUserPolicy_generatedName (32.56s)
--- PASS: TestAccIAMUserPolicy_namePrefix (32.57s)
--- PASS: TestAccIAMUserPolicy_basic (32.85s)
--- PASS: TestAccIAMUserPolicy_multiplePolicies (52.76s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iam	54.524s

@github-actions
Copy link

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 size/XL Managed by automation to categorize the size of a PR. service/iam Issues and PRs that pertain to the iam service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. verify Pertains to the verify package (i.e., provider-level validating, diff suppression, etc.) labels Jan 11, 2023
@YakDriver YakDriver merged commit 1f6bd46 into main Jan 12, 2023
@YakDriver YakDriver deleted the b-iam-diff-improve-policies branch January 12, 2023 17:36
@github-actions github-actions bot added this to the v4.50.0 milestone Jan 12, 2023
github-actions bot pushed a commit that referenced this pull request Jan 12, 2023
@github-actions
Copy link

This functionality has been released in v4.50.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 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 Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/iam Issues and PRs that pertain to the iam service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. verify Pertains to the verify package (i.e., provider-level validating, diff suppression, etc.)
Projects
None yet
1 participant