Interview Prep/Terraform/Authentication and Cloud API Errors

Applies that run longer than an hour fail with `ExpiredToken: The security token included in the request is expired`.

IntermediateTroubleshootingAuthentication and Cloud API Errors
Answer

Likely causes → Assumed-role sessions default to 1 hour; long applies (EKS, RDS, CloudFront) outlive them. Role chaining is capped at 1 hour.

Diagnose → The error appears about 60 minutes into the apply.

Fix → Increase the role's MaxSessionDuration and request more (for example role-duration-seconds: 7200 in the GitHub action, or duration = "2h" in the provider's assume_role). Avoid chaining roles when long sessions are needed.

Prevent → Split slow resources into their own stacks, and set session durations deliberately.

All Terraform questions

More on Authentication and Cloud API Errors