Reputation: 13
locals {
check_list ="test"
trimoutput = trim(local.check_list, "")
}
currently, the trim output value is still "test"
Expected output is just test. I need this value inside terraform code itself
Upvotes: 0
Views: 6376
Reputation: 74064
I think you are confusing the value of the variable in memory with the syntax Terraform uses to show values in the CLI output.
If your goal is to use the raw value of a root module output value to pass on to some subsequent process then you can use the terraform output
command with its -raw
option to tell Terraform to output the value literally, rather than rendering it using normal Terraform language syntax (which for strings includes quotes).
terraform output -raw name_of_output_value
Note that there are no quotes in the string itself. The quotes are just the markers Terraform uses to understand that the characters within are intended to be a string.
Upvotes: 1
Reputation: 401
if you want to include a literal quote mark then you must use a backslash key
locals {
check_list ="test"
trimoutput = trim(local.check_list, "\"")
Upvotes: 1