I have secrets in vault that can look like this:
{
“ClientCredentials:ClientSecret”: “onesecret”,
“SomeSecret”: “anothersecret”,
}
When i try to get the secrets from vault cli using this kind of config:
auto_auth {
method {
type = "token_file"
config = {
token_file_path = ".vault-token"
}
}
}
exit_after_auth = false
template {
destination = ".vault-output"
contents = <<EOH
{{ with secret "path/to/secrets" }}
export SECRET_ENV_VARIABLE="{{ .Data.data.ClientCredentials:ClientSecret }}"
{{ end }}
EOH
}
It works with .Data.data.SomeSecret but it fails with .Data.data.ClientCredentials:ClientSecret with the following message:
[ERROR] agent.template.server: template server error: error=“(dynamic): parse: template: :2
: expected :=”
I cannot find a way to escape the ‘:’ character…
Any idea please?