Interview Prep/DevSecOps/Cloud identity: IRSA, Workload Identity and CI OIDC

A 2-hour Terraform apply from GitHub Actions dies midway with `ExpiredToken: The security token included in the request is expired`

IntermediateTroubleshootingCloud identity: IRSA, Workload Identity and CI OIDC
Answer

Likely causes → configure-aws-credentials defaults to a 1-hour session. If the job chains into another role, role chaining is hard-capped at 1 hour regardless of settings.

Diagnose →

aws iam get-role --role-name gha-deploy --query Role.MaxSessionDuration

Check whether the Terraform provider uses assume_role, which is chaining.

Fix → Raise the role's MaxSessionDuration (up to 43200), set role-duration-seconds: 10800 in the action, and assume the target role directly from OIDC instead of chaining.

Prevent → Split huge applies into smaller state files. Long-running applies are a reliability risk on their own.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Cloud identity: IRSA, Workload Identity and CI OIDC