Staging and prod need different database URLs and different AWS roles, using one workflow. How?
BeginnerScenarioSecrets, OIDC & Environments
Answer
Situation read → Environment-scoped config.
What I'd do →
- Create environments
stagingandprod. - Same names in each: secret
DATABASE_URL, variableDEPLOY_ROLE_ARN. - Job:
environment: ${{ inputs.environment }}and referencesecrets.DATABASE_URL,vars.DEPLOY_ROLE_ARN.
Why → Identical names keep the workflow generic; GitHub resolves values per environment.
Interview tip → Mention that prod secrets are only released after approval.
More on Secrets, OIDC & Environments
You find AWS access keys stored as repo secrets in 25 repos. Plan the migration.IntermediateA developer asks to print a secret in the log "just once" to debug. What do you do instead?BeginnerSecurity requires two people for prod deploys: the author cannot approve. Configure it.BeginnerWrite the AWS trust policy for a role used only by the prod deploy job of one repo.IntermediatePR workflows need read-only AWS access for `terraform plan`, including from same-repo branches. How do you set trust?AdvancedA team stores a 200 KB kubeconfig and certificates as secrets and hits the size limit. What do you recommend?Intermediate