Interview Prep/Terraform/Secrets Provisioners and Policy as Code

Why is `sensitive = true` not enough for a private key resource output?

BeginnerScenarioSecrets Provisioners and Policy as Code
Answer

Situation read → A tls_private_key output is marked sensitive and the team feels safe.

What I'd do →

  1. Explain that sensitive hides the value in CLI output only.
  2. Point out that terraform output -json and the state file still hold it in plain text.
  3. Generate keys outside Terraform where possible, or restrict state access and encrypt.

Why → Redaction is a display feature, not a security boundary.

Interview tip → Be specific: "state is plain JSON".

All Terraform questions

More on Secrets Provisioners and Policy as Code