Can consul-template not handle vault key names with a dash/hyphen in them?
I had some keys in my vault that had dashes in them:
template {
destination = "/tmp/test.value"
perms = 0640
contents = <<EOF
{{with secret "secret/secret-test-1"}}{{.Data.some-key}}{{end}}
{{with secret "secret/secret-test-1"}}{{.Data.longer-key-name}}{{end}}
EOF
}
I would start my consul-template service and get errors:
consul-template: Consul Template returned errors:
consul-template: (dynamic): parse: template: :1: bad character U+002D '-'
systemd: consul-template.service: Main process exited, code=exited, status=14/n/a
systemd: consul-template.service: Unit entered failed state.
I changed the dashes to underscores in the key names, started consul-template again, and it worked fine.
template {
destination = "/tmp/test.value"
perms = 0640
contents = <<EOF
{{with secret "secret/secret-test-1"}}{{.Data.some_key}}{{end}}
{{with secret "secret/secret-test-1"}}{{.Data.longer_key_name}}{{end}}
EOF
}
Did I find a bug? Or is this a known naming convention that is not mentioned in the documentation?
Thanks