Interview Prep/Terraform/State and Backends in Production

How do you keep secrets out of the state file?

IntermediateProductionState and Backends in Production
Answer

Prefer not creating secrets in Terraform at all: let the service generate them (RDS manage_master_user_password = true), reference secret ARNs not values and let apps read from Secrets Manager. Where a secret value must pass through Terraform, use ephemeral resources and write-only arguments (1.10 and 1.11+). Otherwise assume the state contains it and lock the state down.

All Terraform questions Roadmap: Terraform in production

More on State and Backends in Production