-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Bugfix retry behavior in aws_ssoadmin_managed_policy_attachment for eventual consistency issue #19216
Bugfix retry behavior in aws_ssoadmin_managed_policy_attachment for eventual consistency issue #19216
Conversation
…l consistency breaking the apply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @jvitor03 👋
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 CONTRIBUTING 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! 😃
👍 |
Hi @jvitor03 , thank you for this PR and following the contribution guidelines for retry handling! With these eventual consistency errors happening on both create and delete, without a precise timeout as it can depend per account/user, we can instead add a connection retry handler in client.ssoadminconn.Handlers.Retry.PushBack(func(r *request.Request) {
if r.Operation.Name == "AttachManagedPolicyToPermissionSet" || r.Operation.Name == "DetachManagedPolicyFromPermissionSet" {
if tfawserr.ErrCodeEquals(r.Error, ssoadmin.ErrCodeConflictException) {
r.Retryable = aws.Bool(true)
}
}
} |
That looks way better to avoid duplicated code, I will do the change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @jvitor03 🚀
Output of acceptance tests:
--- PASS: TestAccAWSSSOAdminManagedPolicyAttachment_disappears (32.90s)
--- PASS: TestAccAWSSSOAdminManagedPolicyAttachment_disappears_permissionSet (24.52s)
--- PASS: TestAccAWSSSOAdminManagedPolicyAttachment_basic (32.00s)
--- PASS: TestAccAWSSSOAdminManagedPolicyAttachment_forceNew (57.42s)
--- PASS: TestAccAWSSSOAdminManagedPolicyAttachment_multipleManagedPolicies (82.14s)
This has been released in version 3.39.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 for triage. Thanks! |
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. |
Community Note
Closes #19215
This PR adds a retry behavior for Create and destroy in the aws_ssoadmin_managed_policy_attachment-consitency resource.
Output from acceptance testing:
No acceptance testes where created, because they are not reliable to cover eventual consistency issues: https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/contributing/retries-and-waiters.md#eventual-consistency
Full trace log from the fix being used during a destroy: https://gist.github.com/jvitor03/89cb2d10213cebefcd76e95046118968
Log retry summary: