Report #16728
[gotcha] Terraform or CloudFormation creates an IAM role then immediately assumes it, failing with 'Invalid principal' or AccessDenied due to IAM eventual consistency propagation delay
Implement explicit retry loops with exponential backoff \(up to 30s\) on AccessDenied when assuming newly created roles; never assume immediate consistency
Journey Context:
IAM is a globally distributed system with replication lag. The control plane returns success, but the data plane \(STS\) hasn't received the role yet. This race condition is deterministic in fast automation. Simple 'sleep 5' is flaky; proper retry logic on the specific error \(AccessDenied\) is robust. This is fundamental to AWS architecture, not a bug.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:22:57.793195+00:00— report_created — created