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: Add retry for eventual consistency bug in aws_iot_policy #34329

Merged

Conversation

Octogonapus
Copy link
Contributor

@Octogonapus Octogonapus commented Nov 9, 2023

Description

This PR adds retries into the delete logic for aws_iot_policy.
This resource currently has a bug where it can fail to delete because a just-deleted policy attachment
has not yet propagated through AWS's system.
These retries have been added to fix that bug.

Relations

Closes #9541.
Relates #9540.
Closes #30314.
Closes #24979.

References

The AWS API documentation notes that it can take up to five minutes after a policy is detached before it's ready to be deleted: https://docs.aws.amazon.com/iot/latest/apireference/API_DetachPolicy.html

Output from Acceptance Testing

% make testacc TESTS=TestAccXXX PKG=ec2

...

Copy link

github-actions bot commented Nov 9, 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 size/S Managed by automation to categorize the size of a PR. service/iot Issues and PRs that pertain to the iot service. labels Nov 9, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 9, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @Octogonapus 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@ewbankkit ewbankkit added eventual-consistency Pertains to eventual consistency issues. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 10, 2023
…rsionId instead of CreateDate"

This reverts commit 5d528f6.
% make testacc TESTARGS='-run=TestAccIoTPolicy_' PKG=iot ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iot/... -v -count 1 -parallel 2  -run=TestAccIoTPolicy_ -timeout 360m
=== RUN   TestAccIoTPolicy_basic
=== PAUSE TestAccIoTPolicy_basic
=== RUN   TestAccIoTPolicy_disappears
=== PAUSE TestAccIoTPolicy_disappears
=== CONT  TestAccIoTPolicy_basic
=== CONT  TestAccIoTPolicy_disappears
--- PASS: TestAccIoTPolicy_disappears (19.19s)
--- PASS: TestAccIoTPolicy_basic (24.35s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iot	29.768s
% make testacc TESTARGS='-run=TestAccIoTPolicy_' PKG=iot ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iot/... -v -count 1 -parallel 2  -run=TestAccIoTPolicy_ -timeout 360m
=== RUN   TestAccIoTPolicy_basic
=== PAUSE TestAccIoTPolicy_basic
=== RUN   TestAccIoTPolicy_disappears
=== PAUSE TestAccIoTPolicy_disappears
=== RUN   TestAccIoTPolicy_update
=== PAUSE TestAccIoTPolicy_update
=== CONT  TestAccIoTPolicy_basic
=== CONT  TestAccIoTPolicy_update
--- PASS: TestAccIoTPolicy_basic (32.82s)
=== CONT  TestAccIoTPolicy_disappears
--- PASS: TestAccIoTPolicy_update (48.98s)
--- PASS: TestAccIoTPolicy_disappears (17.41s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iot	57.992s
…efault version of the policy if creating a new version would exceed the maximum number of versions (5).
@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Nov 10, 2023
@ewbankkit ewbankkit added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 10, 2023
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/S Managed by automation to categorize the size of a PR. labels Nov 10, 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=TestAccIoTPolicy_' PKG=iot ACCTEST_PARALLELISM=2 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iot/... -v -count 1 -parallel 2  -run=TestAccIoTPolicy_ -timeout 360m
=== RUN   TestAccIoTPolicy_basic
=== PAUSE TestAccIoTPolicy_basic
=== RUN   TestAccIoTPolicy_disappears
=== PAUSE TestAccIoTPolicy_disappears
=== RUN   TestAccIoTPolicy_update
=== PAUSE TestAccIoTPolicy_update
=== RUN   TestAccIoTPolicy_prune
=== PAUSE TestAccIoTPolicy_prune
=== CONT  TestAccIoTPolicy_basic
=== CONT  TestAccIoTPolicy_update
--- PASS: TestAccIoTPolicy_basic (24.73s)
=== CONT  TestAccIoTPolicy_prune
--- PASS: TestAccIoTPolicy_update (41.53s)
=== CONT  TestAccIoTPolicy_disappears
--- PASS: TestAccIoTPolicy_disappears (18.50s)
--- PASS: TestAccIoTPolicy_prune (113.81s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iot	143.701s
% make testacc TESTARGS='-run=TestAccIoTPolicyAttachment_' PKG=iot ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iot/... -v -count 1 -parallel 2  -run=TestAccIoTPolicyAttachment_ -timeout 360m
=== RUN   TestAccIoTPolicyAttachment_basic
--- PASS: TestAccIoTPolicyAttachment_basic (65.89s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iot	71.572s

@ewbankkit
Copy link
Contributor

@Octogonapus Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit a9424c3 into hashicorp:main Nov 13, 2023
43 checks passed
@github-actions github-actions bot added this to the v5.26.0 milestone Nov 13, 2023
@Octogonapus Octogonapus deleted the b-aws_iot_policy-delete_consistency_fix branch November 13, 2023 15:05
Copy link

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

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 Dec 17, 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. documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. eventual-consistency Pertains to eventual consistency issues. service/iot Issues and PRs that pertain to the iot 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.
Projects
None yet
3 participants