HashiCorp Cloud Platform
Retrieve secrets from Vault Secrets
You can retrieve secrets store in HCP Vault Secrets using the HCP Portal, HCP CLI, or HCP API.
Prerequisites
- An HCP IAM user or service principal with the HCP contributor role or higher.
- An HCP Vault Secrets app and secret created.
- Authenticated to the HCP Portal or HCP CLI
Retrieve secret metadata examples
The hcp vault-secrets secrets read
command reads a static, rotating, or
dynamic secret's metadata from the Vault Secrets application.
Read a secret's metadata:
$ hcp vault-secrets secrets read "test_secret"
Read a secret's metadata from under a specified Vault Secrets application:
$ hcp vault-secrets secrets read "test_secret" --app test-app
Retrieve secret examples
The hcp vault-secrets secrets open
command reads the plaintext value of a
static, rotating, or dynamic secret from the Vault Secrets application.
Open plaintext secret:
$ hcp vault-secrets secrets open "test_secret"
Open a plaintext secret from under a specified Vault Secrets application:
$ hcp vault-secrets secrets open "test_secret" --app=test-app
Inject all of the app's secrets as environment variables:
$ hcp vault-secrets secrets run ./my_app.sh