Keys / HCP Terraform

TF_API_TOKEN

An HCP Terraform API token that CI starts runs and uploads configurations with.

Expires
you choose; 2 years if the API call doesn't set one
API
create and delete user, team and organization tokens

Get it

Create one on app.terraform.io/app/settings/tokens. The steps aren't recorded yet.

Set it

TF_API_TOKEN=...

HashiCorp's tfci and its GitHub Actions read it on their own. The Terraform CLI reads TF_TOKEN_app_terraform_io instead. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. Create a new token of the same kind: user, team or organization. For a team, add another token under the team's API tokens, with its own description, so the old one keeps working. Regenerating a legacy team token revokes the old one at once.
  2. An organization has only one valid token, so generating a new one replaces the old one at once.
  3. Deploy the new token everywhere that reads TF_API_TOKEN.
  4. Check that nothing still uses the old token, then delete it.

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.

Sources, checked 2026-11-16