Interview Prep/Terraform/Secrets Provisioners and Policy as Code

A secret leaked in a Terraform plan log in CI. What now?

IntermediateScenarioSecrets Provisioners and Policy as Code
Answer

Situation read → Log retention makes it widely visible.

What I'd do →

  1. Rotate the secret.
  2. Delete or restrict the log and artifacts.
  3. Find why it printed: missing sensitive = true, a local-exec echoing it, or TF_LOG=DEBUG.
  4. Add masking in CI and a check forbidding debug logs in shared runs.

Why → Treat logs as a leak channel; sensitive marking and masking are the controls.

Interview tip → Plan files and terraform show output can also contain secrets.

All Terraform questions

More on Secrets Provisioners and Policy as Code