api_key/apiToken are marked sensitive, and every raw output is redacted. This tutorial is about the layer above that, keeping the token itself out of git and getting it safely into CI, since that layer is entirely on you.
Rule one: never commit a real token
- Export it as an environment variable (
BIZNETGIO_API_KEY) instead of writing it into a committed file. - Never pass it with
-varon the Terraform CLI; command-line arguments end up in your shell history. - Gitignore any
tfvarsfile that ever holds a real value, per the project structure tutorial.
Terraform Cloud variables
If you followed the state and collaboration tutorial’s recommended path, set the token as a workspace variable: category “environment variable”, keyBIZNETGIO_API_KEY, and tick the sensitive checkbox. It’s injected into every plan and apply run and never appears in logs.
Pulumi config and ESC
pulumi config set --secret encrypts the value before writing it to Pulumi.<stack>.yaml:
Pulumi.yaml instead of repeating config set per stack:
GitHub Actions secrets
Store the token as a repository secret, or better, an environment secret scoped to a named environment (for exampleproduction) with required reviewers turned on. That’s what gates the CI/CD tutorial’s apply/up job behind a human approval, since the secret itself is only available once the environment’s protection rules pass.
Rotating a leaked token
- Generate a new one in the portal (see Authentication); the old one stops working immediately.
- Update every place the old value was stored: the CI secret, the Pulumi ESC environment, the Terraform Cloud variable.
- Re-run a plan/preview to confirm the new token authenticates before merging anything.
There’s no scoped token
The Authentication page’s warning applies directly here: the API token grants full control of the account, and there’s no read-only or scoped variant. That means giving a CI pipeline access to it is equivalent to giving that pipeline full account access. Gate who can trigger the pipeline that has it (branch protection, required reviewers on the production environment) as carefully as you’d gate who has the token itself.Next steps
- CI/CD with GitHub Actions - put this token to work in an actual pipeline