I'm creating a Vault Dev Server with sudo vault server -dev and putting a simple KV v2 secret with:
vault kv put secret/database url=db.example.com
I wish confd pick that value whenever value is changed in KV store in Vault. But I'm getting the error:
FATAL template: env.tmpl:2:9: executing "env.tmpl" at <getv "database/url">: error calling getv: key does not exist: database/url
When I run:
sudo confd --onetime --log-level debug --backend vault --auth-type token --auth-token s.ossadqwsssssssafadsd --node http://127.0.0.1:8200 -prefix='/secret'
My /etc/confd/templates/env.tmpl is:
[myconfig]
url = {{ getv "database/url" }}
and /etc/confd/conf.d/myconfig.toml is
[template]
src = "env.tmpl"
dest = "env.conf"
keys = [
"secret/database"
]
Any help would be appreciated.
KV v2 has data in a
/dataprefix. You need to change your path to begetv "data/database/url"in the config template or change prefix to/secret/datain the flag.