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 →
- Explain that sensitive hides the value in CLI output only.
- Point out that
terraform output -jsonand the state file still hold it in plain text. - 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".
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