HashiCorp Vault
You can also store this information in an entity.
The Vault entity can only be used once the database is initialized. Secrets for values that are used before the database is initialized can’t make use of the Vaults entity.
Admin API
cURL
HTTPie
--data name="hcv" \
--data description="Storing secrets in HashiCorp Vault" \
--data config.protocol="https" \
--data config.host="localhost" \
--data config.port="8200" \
--data config.mount="secret" \
--data config.kv="v2" \
Result:
{
"config": {
"host": "localhost",
"mount": "secret",
"port": 8200,
"protocol": "https",
"token": "<mytoken>"
},
"created_at": 1645008893,
"description": "Storing secrets in HashiCorp Vault",
"id": "0b43d867-05db-4bed-8aed-0fccb6667837",
"prefix": "my-hashicorp-vault",
"tags": null,
}
Add the following snippet to your declarative configuration file:
For example, let’s say you’ve configured a HashiCorp Vault with a path of secret/hello
and a key=value pair of foo=world
:
vault kv put secret/hello foo=world
Key Value
--- -----
created_time 2022-01-15T01:40:03.740833Z
custom_metadata <nil>
deletion_time n/a
destroyed false
Access these secrets like this:
{vault://my-hashicorp-vault/hello/foo}