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 →
- Configure Vault's AWS secrets engine with a role mapped to the needed policy.
- The pipeline authenticates to Vault (OIDC/JWT) and requests credentials.
- 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.
More on Secrets Provisioners and Policy as Code
A developer hardcodes a DB password in `terraform.tfvars` and commits it. What do you do right now, and what's the long-term fix?BeginnerHow do you avoid Terraform persisting a secret in state when creating a secret in AWS Secrets Manager?AdvancedSomeone wants a `remote-exec` provisioner to configure servers after creation. What's your advice?BeginnerYou must run a one-off command after a resource is created, such as registering with an external system.IntermediateHow do you generate and manage the master password for a new RDS instance?IntermediateCompare Sentinel, OPA/Conftest and Checkov for policy as code.Intermediate