hashicorp-vaultconsul-template

Writing to Vault secret with consul-template


Im struggling to understand from the doc on how to write to Vault KV using consul-template.

I enabled KV with vault secrets enable -path=secret -version=2 kv

I have the following template,

vault {
  ssl {
    ca_cert = "tls/ca.pem"
  }
  retry {
    backoff = "1s"
  }
}
template {
  contents = <<EOH
    ---
    {{ secret "secret/data/test/admin" "value=test" }}
  EOH
}

However I keep getting,

2019/08/08 22:28:43.201250 [WARN] (view) vault.write(secret/data/test/admin/password -> 2b955093): vault.write(secret/data/test/admin/password -> 2b955093): Error making API request.

URL: PUT http://<vault address>/v1/secret/data/test/admin
Code: 400. Errors:

* no data provided (retry attempt 2 after "500ms")

I have figured out how to read from the store as its well documented but not writing to it. Any help is appreciated


Solution

  • This has been raised as a bug in #1252.