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

Add consistency check during CreateTopic to handle ABAC vs. eventual consistency issues #30432

Merged
merged 10 commits into from
Apr 14, 2023

Conversation

curator
Copy link
Contributor

@curator curator commented Apr 4, 2023

Description

Adds a consistency check/retry for sns:CreateTopic to handle operation with tight ABAC permissions on the IAM policy of the provisioner.

Relations

Closes #29973

References

Output from Acceptance Testing

└─ preston.norvell@GI-VT365WWNVQ ~/Documents/gitrepos/golang/src/github.com/terraform-providers/terraform-provider-aws ᐅ make testacc TESTS="TestAccSNSTopic_" PKG=sns TESTARGS=-short
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sns/... -v -count 1 -parallel 20 -run='TestAccSNSTopic_' -short -timeout 180m
=== RUN   TestAccSNSTopic_basic
=== PAUSE TestAccSNSTopic_basic
=== RUN   TestAccSNSTopic_disappears
=== PAUSE TestAccSNSTopic_disappears
=== RUN   TestAccSNSTopic_name
=== PAUSE TestAccSNSTopic_name
=== RUN   TestAccSNSTopic_namePrefix
=== PAUSE TestAccSNSTopic_namePrefix
=== RUN   TestAccSNSTopic_tags
=== PAUSE TestAccSNSTopic_tags
=== RUN   TestAccSNSTopic_policy
=== PAUSE TestAccSNSTopic_policy
=== RUN   TestAccSNSTopic_withIAMRole
=== PAUSE TestAccSNSTopic_withIAMRole
=== RUN   TestAccSNSTopic_withFakeIAMRole
=== PAUSE TestAccSNSTopic_withFakeIAMRole
=== RUN   TestAccSNSTopic_withDeliveryPolicy
=== PAUSE TestAccSNSTopic_withDeliveryPolicy
=== RUN   TestAccSNSTopic_deliveryStatus
=== PAUSE TestAccSNSTopic_deliveryStatus
=== RUN   TestAccSNSTopic_NameGenerated_fifoTopic
=== PAUSE TestAccSNSTopic_NameGenerated_fifoTopic
=== RUN   TestAccSNSTopic_Name_fifoTopic
=== PAUSE TestAccSNSTopic_Name_fifoTopic
=== RUN   TestAccSNSTopic_NamePrefix_fifoTopic
=== PAUSE TestAccSNSTopic_NamePrefix_fifoTopic
=== RUN   TestAccSNSTopic_fifoWithContentBasedDeduplication
=== PAUSE TestAccSNSTopic_fifoWithContentBasedDeduplication
=== RUN   TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
=== PAUSE TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
=== RUN   TestAccSNSTopic_encryption
=== PAUSE TestAccSNSTopic_encryption
=== CONT  TestAccSNSTopic_basic
=== CONT  TestAccSNSTopic_withDeliveryPolicy
=== CONT  TestAccSNSTopic_withFakeIAMRole
=== CONT  TestAccSNSTopic_withIAMRole
=== CONT  TestAccSNSTopic_NamePrefix_fifoTopic
=== CONT  TestAccSNSTopic_NameGenerated_fifoTopic
=== CONT  TestAccSNSTopic_encryption
=== CONT  TestAccSNSTopic_fifoWithContentBasedDeduplication
=== CONT  TestAccSNSTopic_tags
=== CONT  TestAccSNSTopic_Name_fifoTopic
=== CONT  TestAccSNSTopic_deliveryStatus
=== CONT  TestAccSNSTopic_disappears
=== CONT  TestAccSNSTopic_policy
=== CONT  TestAccSNSTopic_namePrefix
=== CONT  TestAccSNSTopic_name
=== CONT  TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
--- PASS: TestAccSNSTopic_fifoExpectContentBasedDeduplicationError (3.58s)
--- PASS: TestAccSNSTopic_disappears (16.06s)
--- PASS: TestAccSNSTopic_Name_fifoTopic (19.60s)
--- PASS: TestAccSNSTopic_basic (20.18s)
--- PASS: TestAccSNSTopic_policy (20.35s)
--- PASS: TestAccSNSTopic_NamePrefix_fifoTopic (20.46s)
--- PASS: TestAccSNSTopic_name (20.61s)
--- PASS: TestAccSNSTopic_withDeliveryPolicy (20.81s)
--- PASS: TestAccSNSTopic_namePrefix (20.85s)
--- PASS: TestAccSNSTopic_NameGenerated_fifoTopic (20.88s)
--- PASS: TestAccSNSTopic_withIAMRole (26.31s)
--- PASS: TestAccSNSTopic_encryption (27.03s)
--- PASS: TestAccSNSTopic_fifoWithContentBasedDeduplication (27.25s)
--- PASS: TestAccSNSTopic_deliveryStatus (27.43s)
--- PASS: TestAccSNSTopic_tags (33.48s)
--- PASS: TestAccSNSTopic_withFakeIAMRole (129.39s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sns	132.218s

@github-actions
Copy link

github-actions bot commented Apr 4, 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/sns Issues and PRs that pertain to the sns service. size/XS Managed by automation to categorize the size of a PR. labels Apr 4, 2023
@curator curator changed the title Add snippet to handle consistency check during CreateTopic to handle … Add consistency check during CreateTopic to handle … Apr 4, 2023
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Thank you for your contribution! 🚀

Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the go.mod or go.sum files and commit them into this pull request.

Additional details:

  • Check open pull requests with the dependencies label to view other dependency updates.
  • If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed.
  • If this pull request is for supporting a new AWS service:
    • Ensure the new AWS service changes are following the Contributing Guide section on new services, in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split.
    • If this pull request is already a separate pull request from the above item, you can ignore this message.

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Thank you for your contribution! 🚀

Please note that the CHANGELOG.md file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the Contributing Guide for additional pull request review items.

Remove any changes to the CHANGELOG.md file and commit them in this pull request to prevent delays with reviewing and potentially merging this pull request.

@curator
Copy link
Contributor Author

curator commented Apr 5, 2023

I can't seem to get past the one error I'm receiving in here in the CI run. Could I get a bit of help? I see that other pipelines from other PRs are also generating this error recently, so might it have something to do with recent commits?

Thanks much,

;P mn

@curator
Copy link
Contributor Author

curator commented Apr 7, 2023

Looks like it resolved upstream. Ready for review.

@ewbankkit ewbankkit changed the title Add consistency check during CreateTopic to handle … Add consistency check during CreateTopic to handle ABAC vs. eventual consistency issues Apr 14, 2023
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. eventual-consistency Pertains to eventual consistency issues. labels Apr 14, 2023
@ewbankkit ewbankkit self-assigned this Apr 14, 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=TestAccSNSTopic_' PKG=sns ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sns/... -v -count 1 -parallel 3  -run=TestAccSNSTopic_ -timeout 180m
=== RUN   TestAccSNSTopic_basic
=== PAUSE TestAccSNSTopic_basic
=== RUN   TestAccSNSTopic_disappears
=== PAUSE TestAccSNSTopic_disappears
=== RUN   TestAccSNSTopic_name
=== PAUSE TestAccSNSTopic_name
=== RUN   TestAccSNSTopic_namePrefix
=== PAUSE TestAccSNSTopic_namePrefix
=== RUN   TestAccSNSTopic_tags
=== PAUSE TestAccSNSTopic_tags
=== RUN   TestAccSNSTopic_policy
=== PAUSE TestAccSNSTopic_policy
=== RUN   TestAccSNSTopic_withIAMRole
=== PAUSE TestAccSNSTopic_withIAMRole
=== RUN   TestAccSNSTopic_withFakeIAMRole
=== PAUSE TestAccSNSTopic_withFakeIAMRole
=== RUN   TestAccSNSTopic_withDeliveryPolicy
=== PAUSE TestAccSNSTopic_withDeliveryPolicy
=== RUN   TestAccSNSTopic_deliveryStatus
=== PAUSE TestAccSNSTopic_deliveryStatus
=== RUN   TestAccSNSTopic_NameGenerated_fifoTopic
=== PAUSE TestAccSNSTopic_NameGenerated_fifoTopic
=== RUN   TestAccSNSTopic_Name_fifoTopic
=== PAUSE TestAccSNSTopic_Name_fifoTopic
=== RUN   TestAccSNSTopic_NamePrefix_fifoTopic
=== PAUSE TestAccSNSTopic_NamePrefix_fifoTopic
=== RUN   TestAccSNSTopic_fifoWithContentBasedDeduplication
=== PAUSE TestAccSNSTopic_fifoWithContentBasedDeduplication
=== RUN   TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
=== PAUSE TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
=== RUN   TestAccSNSTopic_encryption
=== PAUSE TestAccSNSTopic_encryption
=== CONT  TestAccSNSTopic_basic
=== CONT  TestAccSNSTopic_withDeliveryPolicy
=== CONT  TestAccSNSTopic_NamePrefix_fifoTopic
--- PASS: TestAccSNSTopic_basic (29.36s)
=== CONT  TestAccSNSTopic_encryption
--- PASS: TestAccSNSTopic_NamePrefix_fifoTopic (29.68s)
=== CONT  TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
--- PASS: TestAccSNSTopic_withDeliveryPolicy (30.69s)
=== CONT  TestAccSNSTopic_fifoWithContentBasedDeduplication
--- PASS: TestAccSNSTopic_fifoExpectContentBasedDeduplicationError (5.76s)
=== CONT  TestAccSNSTopic_tags
--- PASS: TestAccSNSTopic_encryption (62.12s)
=== CONT  TestAccSNSTopic_withFakeIAMRole
--- PASS: TestAccSNSTopic_fifoWithContentBasedDeduplication (61.20s)
=== CONT  TestAccSNSTopic_withIAMRole
--- PASS: TestAccSNSTopic_tags (79.52s)
=== CONT  TestAccSNSTopic_policy
--- PASS: TestAccSNSTopic_withIAMRole (52.65s)
=== CONT  TestAccSNSTopic_NameGenerated_fifoTopic
--- PASS: TestAccSNSTopic_policy (50.11s)
=== CONT  TestAccSNSTopic_Name_fifoTopic
--- PASS: TestAccSNSTopic_NameGenerated_fifoTopic (39.03s)
=== CONT  TestAccSNSTopic_name
--- PASS: TestAccSNSTopic_Name_fifoTopic (31.25s)
=== CONT  TestAccSNSTopic_namePrefix
--- PASS: TestAccSNSTopic_name (29.36s)
=== CONT  TestAccSNSTopic_disappears
--- PASS: TestAccSNSTopic_namePrefix (28.42s)
=== CONT  TestAccSNSTopic_deliveryStatus
--- PASS: TestAccSNSTopic_withFakeIAMRole (133.78s)
--- PASS: TestAccSNSTopic_disappears (22.19s)
--- PASS: TestAccSNSTopic_deliveryStatus (37.60s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sns	271.647s

@ewbankkit
Copy link
Contributor

@curator Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 4671019 into hashicorp:main Apr 14, 2023
35 checks passed
@github-actions github-actions bot added this to the v4.64.0 milestone Apr 14, 2023
@github-actions
Copy link

This functionality has been released in v4.64.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 May 21, 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. eventual-consistency Pertains to eventual consistency issues. service/sns Issues and PRs that pertain to the sns service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Unable to sns:CreateTopic when using proper ABAC permissions in providers newer than 4.0
2 participants