TA-002-P · Question #203
Mary has created a database instance in AWS and for ease of use is outputting the value of the database password with the following code: 1. output "db_password" 2. { 3. value = local.db_password 4…
The correct answer is B. Use sensitive parameter. Terraform's sensitive = true output argument suppresses the value from appearing in CLI output after terraform apply.
Question
Options
- AUse secure parameter
- BUse sensitive parameter
- CUse cryptographic hash
- DEncrypt the value using encrypt() function
How the community answered
(44 responses)- A11% (5)
- B77% (34)
- C2% (1)
- D9% (4)
Why each option
Terraform's `sensitive = true` output argument suppresses the value from appearing in CLI output after `terraform apply`.
`secure` is not a valid Terraform output block argument; no such parameter exists in the Terraform language.
Adding `sensitive = true` to an output block marks the value as sensitive, causing Terraform to redact it in CLI output and plan diffs, displaying `(sensitive value)` instead. This is the built-in, idiomatic Terraform mechanism for hiding secrets like database passwords without altering the underlying value.
Using a cryptographic hash would transform the value permanently and would not allow downstream consumers to retrieve the original password; it is not a Terraform output feature.
Terraform does not provide an `encrypt()` built-in function; encryption logic must be handled externally and is not how sensitive outputs are suppressed in the CLI.
Concept tested: Sensitive output values suppression in Terraform
Source: https://developer.hashicorp.com/terraform/language/values/outputs#sensitive-suppressing-values-in-cli-output
Topics
Community Discussion
No community discussion yet for this question.