sensitive value
A variable or output marked sensitive = true, which Terraform hides in plan output and the terminal but still stores in state in plain text.
In more detail
Anything built from a sensitive value is also sensitive, and an output that uses one must be marked sensitive or the plan fails. terraform output -raw and -json still print the real value on purpose. Sensitive protects the terminal, never the state file.
Examples
Reading sensitive_attributes from terraform.tfstate finds every secret stored insideoutput "admin_password" {
value = random_password.admin.result
sensitive = true
}Related terms
- Terraform state — Terraform's record, usually a JSON file called terraform.tfstate, mapping each resource in the configuration to the real object it created.
- terraform plan — The command that compares configuration, state and reality and prints the actions needed to make them match, without changing anything.
- secret — Any value that grants access, such as a password, access token or private key, and must be kept out of code and version control.
- ephemeral values — Values, added in Terraform 1.10, that exist only during a run and are never written to state or plan files.
- output value — A named value a configuration publishes after apply, declared in an output block, like the return value of a function.
Related guides
Taught in
- Enforcing OPA Guardrails on Terraform Plan Payloads — Cloud Security & DevSecOps Engineering
- Continuous IaC Drift Detection & State Protection — Cloud Security & DevSecOps Engineering
- Parameterising With Input Variables — Infrastructure as Code with Terraform
- Return Values: Outputs And Locals — Infrastructure as Code with Terraform
- The Problem With Local State — Infrastructure as Code with Terraform
- Configuring A Remote Backend — Infrastructure as Code with Terraform
- State Locking With Use Lockfile — Infrastructure as Code with Terraform
- Workspaces For Multiple Environments — Infrastructure as Code with Terraform
- Security: Secrets In State And Ephemeral Values — Infrastructure as Code with Terraform
- State: Terraform's Memory Of What It Built — HashiCorp Terraform Associate (004) Exam Prep
- Input Variables, Outputs, And Which Value Wins — HashiCorp Terraform Associate (004) Exam Prep
- Complex Types: Lists, Sets, Maps, Objects And Tuples — HashiCorp Terraform Associate (004) Exam Prep
- Count, For Each And Dynamic Blocks — HashiCorp Terraform Associate (004) Exam Prep
- Custom Conditions: Validation, Pre And Postconditions, Checks — HashiCorp Terraform Associate (004) Exam Prep
- Sensitive Data, Ephemeral Values And Secrets From Vault — HashiCorp Terraform Associate (004) Exam Prep
- Module Scope: What Goes In, What Comes Out — HashiCorp Terraform Associate (004) Exam Prep
- State Locking: One Writer At A Time — HashiCorp Terraform Associate (004) Exam Prep