Interview Prep/Terraform/Modules, Variables, Sensitive Values and Workspaces

`Error: Output refers to sensitive values` — `Terraform requires that any root module output containing sensitive data be explicitly marked as sensitive`.

BeginnerTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer

Likely causes → The output uses a sensitive variable or a sensitive resource attribute (like aws_db_instance.main.password, or a module output marked sensitive).

Diagnose → Trace the value; check for sensitive = true upstream.

Fix → Add sensitive = true to the output. Read it with terraform output -raw db_password only when needed. Or don't output secrets at all.

Prevent → Prefer outputting secret ARNs/names (Secrets Manager) instead of secret values.

All Terraform questions Roadmap: Terraform

More on Modules, Variables, Sensitive Values and Workspaces