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

    1. --data name="hcv" \
    2. --data description="Storing secrets in HashiCorp Vault" \
    3. --data config.protocol="https" \
    4. --data config.host="localhost" \
    5. --data config.port="8200" \
    6. --data config.mount="secret" \
    7. --data config.kv="v2" \

    Result:

    1. {
    2. "config": {
    3. "host": "localhost",
    4. "mount": "secret",
    5. "port": 8200,
    6. "protocol": "https",
    7. "token": "<mytoken>"
    8. },
    9. "created_at": 1645008893,
    10. "description": "Storing secrets in HashiCorp Vault",
    11. "id": "0b43d867-05db-4bed-8aed-0fccb6667837",
    12. "prefix": "my-hashicorp-vault",
    13. "tags": null,
    14. }

    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:

    1. vault kv put secret/hello foo=world
    2. Key Value
    3. --- -----
    4. created_time 2022-01-15T01:40:03.740833Z
    5. custom_metadata <nil>
    6. deletion_time n/a
    7. destroyed false

    Access these secrets like this:

    1. {vault://my-hashicorp-vault/hello/foo}