Today I Learned

Issue with double quoted chars from terraform output

Sometime ago I noticed terraform outputs an error when running a make command:

╰─$ `terraform output gcloud_connection_command`
zsh: command not found: "gcloud

As it appeared, since the 0.14.0 version, terraform changed the way output formats the response. Since that release, terraform adds double back quotes around the returned text:

╰─$ terraform output gcloud_connection_command                                                                                                                                               
"gcloud container clusters get-credentials tilcra-staging-cluster --project tilcra --zone europe-west3-c"

To get back to the old output, add -raw flag to the command:

╰─$ terraform output -raw gcloud_connection_command
gcloud container clusters get-credentials tilcra-staging-cluster --project tilcra --zone europe-west3-