
This assumes the following has already been done.
- Hashicorp Vault has been installed
- Hashicorp Vault has been initialized
- Hashicorp Vault has been unsealed
Let's say the secrets engine has been enabled with -path=secret/
~]# vault secrets enable -path=secret/ kv
Success! Enabled the kv secrets engine at: secret/
And let's say approle has been enabled and there is a role named "my-role" and contains a policy named "my-policy".
~]$ vault read auth/approle/role/my-role
Key Value
--- -----
policies [my-policy]
In this example, since the secrets engine has been enabled with -path=secret/ the policy path will need to begin with secret/
Let's say "my-policy" permits the following capabilities to "secret/my_path/*".
~]$ vault policy read my-policy
path "secret/my_path/*" {
capabilities = ["create", "delete", "list", "patch", "read", "update"]
}
Before deleting a secret, the vault kv list command can be used to list the secrets that have been created. In this example, there are two secrets, one named "foo" and another named "bar".
~]# vault kv list secret/
Keys
----
foo
bar
Let's say you want to delete the secret named "foo". The vault kv delete command can be used.
~]# vault kv delete secret/foo
Success! Data deleted (if it existed) at: secret/foo
Did you find this article helpful?
If so, consider buying me a coffee over at