Goal: I want to print out a sensitive value of foo_resource.name.sensitive_field
.
Originally I attempted to create an output:
output "password" {
value = foo_resource.name.sensitive_field
}
and I got
Error: Output refers to sensitive values
│
│ on main.tf line 186:
│ 186: output "password" {
│
│ To reduce the risk of accidentally exporting sensitive data that was intended to be only internal, Terraform requires that any root module output containing sensitive data be
│ explicitly marked as sensitive, to confirm your intent.
│
│ If you do intend to export this data, annotate the output value as sensitive by adding the following argument:
│ sensitive = true
╵
so I added sensitive = true
to it:
output "password" {
value = foo_resource.name.sensitive_field
sensitive = true
}
and then when I run it again I got:
$ terraform output
password = <sensitive>