I have a template for a Nomad job that includes the following template stanza:
template {
data = <<EOH
...
index => "index=%{+YYYY.MM.dd}"
...
user => "{{ key "some/consul/key" }}"
...
EOH
destination = "local/file.yml"
}
nomad run
results in the following error:
Error getting job struct: Failed to parse using HCL 2. Use the HCL 1 parser with `nomad run -hcl1`, or address the following issues:
stdin:52,31-32: Invalid template directive; A template directive keyword ("if", "for", etc) is expected at the beginning of a %{ sequence.
How do I create a file using templating that contains %{
without having it interpreted and resulting in this failure? I’m guessing there is some heredoc or escaping that will solve this, but I haven’t figured it out yet. Any suggestions would be greatly appreciated. Thanks!