Is there a way to make local Terraform variables sensitive with a Terraform version older than 0.15?

1k Views Asked by At

I notice Terraform version 0.15 has the sensitive function to make variables sensitive. My sensitive variable is currently being printed to the Terraform Cloud console on runtime. However, I'm using a previous version of Terraform (0.14.5) and the sensitive function doesn't exist with this version. I want to do this with the variable defined within a local block like this:

password = 
sensitive(jsondecode(data.aws_secretsmanager_secret_version.secret_val.secret_string)["my_password"])

My current code looks like this, because I cannot use the sensitive() function:

password = 
jsondecode(data.aws_secretsmanager_secret_version.secret_val.secret_string)["my_password"]

I know it's possible to have this functionality with other variable types however what is the best way of doing this for local variables in version 0.14.5 of Terraform?

1

There are 1 best solutions below

0
Martin Atkins On

The ability of dynamically tracking sensitive values derived from other values was a new feature in Terraform v0.15, so there is no way to make use of it in earlier versions of Terraform.