Interview Prep/Terraform/Secrets Provisioners and Policy as Code

Terraform needs temporary admin-like credentials for AWS. How can Vault help?

IntermediateScenarioSecrets Provisioners and Policy as Code
Answer

Situation read → Static keys are risky; dynamic ones expire.

What I'd do →

  1. Configure Vault's AWS secrets engine with a role mapped to the needed policy.
  2. The pipeline authenticates to Vault (OIDC/JWT) and requests credentials.
  3. Export them as AWS_* environment variables for the run; they expire in minutes.

Why → There's no long-lived credential to steal; every run's access is logged in Vault.

Interview tip → Mention that HCP Terraform dynamic credentials give the same pattern natively.

All Terraform questions

More on Secrets Provisioners and Policy as Code