HCP CLI overview for HCP Vault Secrets
The HCP CLI supports HCP Vault Secrets using the vault-secrets
command group.
Refer to the HCP CLI section for a
complete list of all supported vault-secrets
commands.
Login to HCP Vault Secrets
You can login interactively using a web browser or configure the hcp
CLI for non-interactive workflows.
The hcp auth login
command will authenticate you with the HashiCorp Cloud Platform.
Open a terminal and run
hcp auth login
.A new browser window will open.
Log into the HCP Portal using your username and password.
Return to the terminal, the
Successfully logged in!
message appears.The
auth login
command will try to configure default organization and project. When multiple organizations or projects are detected, you will be prompted to runhcp profile init
.Run
hcp profile init
to configure (or update) the default profile.Use the arrow keys on the keyboard to select an organization.
Example output:
Use the arrow keys on the keyboard to select a project.
Example output:
When prompted, type
y
toconfigure any service related config
. Selectvault-secrets
, then select the desired app.Example output:
You can now use the
hcp
CLI.
Create a secret
Use the vault-secrets
command family to create secrets.
You can create a secret by specifying a data file, or piping the secret using STDIN.
Read a secret
Use the vault-secrets
command family to open secrets.
The open
command returns the value of a secret.
Delete a secret
Use the vault-secrets
command family to delete secrets.
The delete
command to remove a secret.
Logout of HCP Vault Secrets
Use the auth
command family to logout.