Interview Prep/GitHub Actions/Secrets, OIDC & Environments

PR workflows need read-only AWS access for `terraform plan`, including from same-repo branches. How do you set trust?

AdvancedScenarioSecrets, OIDC & Environments
Answer

Situation read → Separate low-privilege role for PRs.

What I'd do →

  1. Role tf-plan-readonly with ReadOnlyAccess plus state bucket read and lock table access.
  2. Trust sub = repo:devopsshack/infra:pull_request.
  3. Fork PRs do not get the OIDC token with secrets context in a usable way; keep plans for forks disabled or manual.

Why → PR code is less trusted, so its identity gets read-only permissions, while apply uses a different environment-pinned role.

Interview tip → Two roles, two trust subjects: one for PRs, one for the gated apply.

All GitHub Actions questions Roadmap: GitHub Actions

More on Secrets, OIDC & Environments