A security-conscious team is reviewing their Terraform setup. They are concerned about sensitive values in state. Which of the following statements about sensitive data in Terraform state are TRUE? (Select TWO)
- A. Terraform automatically excludes sensitive output values from the state file to prevent exposure.
- B. Using a remote backend like S3 with server-side encryption (SSE) is the recommended way to protect sensitive values stored in state at rest.✓ Correct
- C. Sensitive values marked with
sensitive = trueare stored in plaintext in the state file, despite being redacted in CLI output.✓ Correct - D. Marking a variable as
sensitive = trueencrypts its value in the state file using AES-256. - E. The
sensitiveattribute in a variable or output block prevents the value from being written to the state file entirely.
Explanation
Options B and C are correct. The sensitive = true flag in Terraform only redacts values from CLI output and plan displays — it does NOT encrypt or exclude the value from the state file. The state file always stores all resource attributes in plaintext JSON. Therefore, encrypting the state file at rest (e.g., using S3 SSE, GCS encryption, or Azure Storage encryption) is the correct mechanism to protect sensitive data. Option D is wrong — sensitive = true does not perform any encryption; it is purely a display control. Option A is wrong — sensitive outputs are written to state; they are just redacted in terminal output. Option E is wrong — sensitive does not prevent writing to state; it only controls display behavior.