We are using nomad template to add environment variables for our nomad deployments.
template {
data = <<EOH
Key1=value1
Key2=value2
Key3=AJsonstring
EOH
change_mode = "restart"
destination = "environments/file.env"
env = true
}
I notice that nomad requires me to escape my JSON string in order for me to properly pass it in.
Ie: say i want to pass in {"a":3,"b":4}
in Key3
I cannot just write it as is, instead, i had to write "{\"a\":3,\"b\":4}"
which is a lot less readable.
Is there a way so I can just pass the plain string in and make it to interprets it as is?
I'd try using single quotes around your JSON object:
key3='{"a": 3, "b": 4 }'
.note: I haven't tested this! Just a guess based on how I'd expect things are put together.