Interview Prep/Real-World Interview/Infrastructure as Code & Terraform state

How did you handle secrets in Terraform?

AdvancedBehavioralInfrastructure as Code & Terraform state
Answer

Good answer looks like → "We didn't put secret values in Terraform where avoidable. RDS used manage_master_user_password = true so AWS generated and stored the password in Secrets Manager. When a secret had to pass through Terraform, we marked outputs sensitive = true, knowing the value still lands in state, which is why the state bucket was encrypted with KMS and tightly restricted."

Follow-ups to expect → Does sensitive keep the value out of state? Have you used ephemeral resources or write-only arguments?

Red flags → Passwords in .tfvars committed to Git.

All Real-World Interview questions Roadmap: Interview readiness

More on Infrastructure as Code & Terraform state