Keys / HashiCorp Vault
VAULT_TOKEN
A Vault token the Vault CLI and client libraries authenticate to a Vault server with.
- Starts with
hvs.- Expires
- at its TTL; the system max TTL is 32 days by default
- API
- create, look up, renew and revoke, with the token auth method
Get it
Create one on developer.hashicorp.com/vault/docs/commands/token/create. The steps aren't recorded yet.
Set it
VAULT_TOKEN=hvs....
The Vault CLI and the Go client github.com/hashicorp/vault/api read it on their own. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Log in again with your auth method to get a new token with the same policies, TTL and period. Don't make it with
vault token createwhile signed in with the old token: that creates a child, and revoking the old token revokes its children. - If you must use
vault token create, add-orphanso the new token has no parent. That needs sudo permission. - Deploy the new token everywhere that reads
VAULT_TOKEN. - Check that nothing still uses the old token, then run
vault token revoke <token>.
Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.