Escaping quotes in Terraform May 17, 2020 I had a slightly tricky issue recently whereby I needed to use a JQ expression as part of a local-exec. The JQ expression needed quotes however Terraform wasn’t happy with them. It was a simple case of escaping with backslashes. resource "null_resource" "confluent-kafka-env" { provisioner "local-exec" { when = "destroy" command = "ccloud environment list -o json | jq '.[] | select(.name | contains(\"${var.env-name}\")) .id'" } provisioner "local-exec" { command = "ccloud environment create ${var.env-name} -o json >> env_id.json" } }