aws_cloudformation_stack may need retry logic when utilizing iam_role_arn attribute #22834
Labels
eventual-consistency
Pertains to eventual consistency issues.
service/cloudformation
Issues and PRs that pertain to the cloudformation service.
service/iam
Issues and PRs that pertain to the iam service.
Milestone
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Note: providing the AWS Cloudtrail log in lieu of debug as that seems the more relevant thing.
Expected Behavior
aws_cloudformation_stack should have been able to assume the role and provision utilizing the given iam_role.
Actual Behavior
Note!!!! Behavior is intermittent and seems to depend on time of day/region/aws load/etc and is a problem in the AWS side, not the TF side, though the TF side could deal with this with retry logic I think.
I assume the iam role takes a second to propagate on the AWS side and isn't available to use yet. Looking at the tests for the cloudformation_stack resource, I noticed there aren't any ci-tests that create/use an IAM role. I assume if there were, retry logic would need to be added to the stack.go when a ValidationException "role cannot be assumed" error occurs.
Steps to Reproduce
terraform apply
Important Factoids
Intermittent sadly but trust me, it happens.
References
Here is a post from AWS talking about how there can be slight delays in IAM things as it is a distributed system.
The text was updated successfully, but these errors were encountered: