Enabling a Secret Engine
Depending on your desired architecture, we might want to enable several secret engines. This can be done through the steps below
vault secret enable -path=test-env kv #version 1
vault secret enable -path=test-env -version=2 kv #version 2
cat test.json
{
"type": "kv",
"options": {
"version": "1"
}
}
#via the API
curl --header "X-Vault-Token: $VAULT_TOKEN" --request POST --data @test.json $VAULT_ADDR/v1/tmp/project/test-env
view active engines
vault secrets list
put a secret in the test-env path
vault kv put test-env/john age=23 month=october
updating the secret
vault write test-env/john month=may
Success! Data written to: test-env/john
move secret env path
vault secrets move test-env uat-env
cat uat.json
{
"from": "test-env",
"to": "uat-env"
}
#via API
curl --header "X-Vault-Token: $VAULT_TOKEN" --request POST --data @uat.json $VAULT_ADDR/v1/tmp/project/uat-env
enabling versioning
vault kv enable-versioning uat-env
#via API
cat version.json
{
"options":{
"version": "2"
}
}
curl --header "X-Vault-Token: $VAULT_TOKEN" --request POST --data @version.json $VAULT_ADDR/v1/tmp/project/uat-env/tune
disable the secret engine
vault secrets disable test-env
#via API
curl --header "X-Vault-Token: $VAULT_TOKEN" --request DELETE $VAULT_ADDR/v1/tmp/project/uat-env