Interview Prep/CI/CD/Secrets and Credentials

How do you use HashiCorp Vault with CI/CD?

AdvancedProductionSecrets and Credentials
Answer

Authenticate the pipeline to Vault with its identity instead of a stored token: GitHub OIDC (hashicorp/vault-action with method: jwt), GitLab id_tokens, or Kubernetes auth for in-cluster agents. A Vault role binds the JWT claims (repo, branch/environment) to a policy granting read access to only that application's path, with a short token TTL. Use dynamic secrets (database or cloud credentials generated per job and revoked after) where possible, so even a leaked value expires in minutes.

- uses: hashicorp/vault-action@v3
  with:
    url: https://vault.example.com
    method: jwt
    role: shop-api-ci
    secrets: |
      secret/data/ci/shop-api registry_token | REGISTRY_TOKEN
All CI/CD questions

More on Secrets and Credentials