Secrets and variables¶
The full list of what to set on the landing-zone repository, in one place. The bootstrap writes most of them, the checks App key included.
Repository variables¶
Set under Settings, Secrets and variables, Actions, Variables.
| Variable | Required | Purpose |
|---|---|---|
AZURE_TENANT_ID |
yes | Tenant id. The license entitlement must be bound to this tenant. |
AZURE_SUBSCRIPTION_ID |
yes | Subscription id for the state account and default context. |
BACKEND_AZURE_RESOURCE_GROUP_NAME |
yes | State storage resource group, read by root.hcl. |
BACKEND_AZURE_STORAGE_ACCOUNT_NAME |
yes | State storage account, read by root.hcl. |
BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME |
yes | State container, read by root.hcl. |
RUNNER_LABEL |
for private state | Self-hosted runner label. Falls back to ubuntu-latest. |
TFPR_EXTRA_TOOLS |
for the gates | Space-separated gate tools to install per run. conftest checkov on a GitHub-hosted posture (the self-hosted runner image carries both). The bootstrap adds infracost when it has an Infracost key. |
TFPR_LICENSE |
for tfpr apply |
The license. The bootstrap writes it from tfpr_license. An organization variable also works, on a paid GitHub plan only. See License. |
TFPR_ENTITLEMENT |
for tfpr apply |
The entitlement for this organization and Azure tenant. The bootstrap's scripts/onboard.sh fetches it from the portal and writes it. See License. |
TFPR_CHECKS_APP_CLIENT_ID |
yes | Checks App client id. The engine's check rows, the merge gate included, are written under this App. Set by the bootstrap when checks_app_client_id is supplied. |
TFPR_ALLOW_UNREVIEWED_APPLY |
only for a repo with no required reviews | true allows tfpr apply when the repository requires no approving reviews. The bootstrap sets it in exactly that case. Leave unset everywhere else. |
TFPR_PLAN_ENVIRONMENT |
optional | Override the plan environment name. Default plan. |
TFPR_APPLY_ENVIRONMENT |
optional | Override the apply environment name. Default apply. |
TFPR_UNLOCK_ENVIRONMENT |
optional | Override the environment the unlock job binds. Defaults to the plan environment. |
TFPR_LOCK_STORAGE_ACCOUNT |
optional | Storage account for the cross-PR unit lock table. Defaults to the BACKEND_AZURE_STORAGE_ACCOUNT_NAME account; required only for a plain Terraform repo with no backend variables. |
TFPR_LOCK_TABLE |
optional | Table name for the unit locks. Default tfprlocks. |
TFPR_INIT_ARGS |
optional | Extra arguments appended to every init the engine runs. |
TFPR_APPLY_PARALLELISM |
optional | How many units with no dependency between them tfpr apply applies at the same time. Default 2; 1 applies one unit at a time. |
TFPR_DISABLE_LOCKS |
optional | Set to true to turn cross-PR unit locking off. Leave unset everywhere else. |
TFPR_CHECK_LIVE_LOG |
optional | Set to true to show the latest 30 lines of a running unit's output in its check text, refreshed about every 30 seconds and passed through the secret scrubber. Off by default; the check title shows the phase either way. |
TFPR_MINIMIZE_OUTDATED |
optional | Outdated run reports are minimized by default, with a banner linking to the report that replaced them. Set to false to opt out and keep every run's comment at full size. |
TFPR_ALLOW_UNREVIEWED_APPLY is a real relaxation
The engine reads GitHub's review decision to gate tfpr apply. A repository that
requires no approving reviews reports an empty decision, which the engine
refuses, so tfpr apply never runs and there is nothing to approve to unblock it.
Only that case needs this variable.
An empty decision is refused rather than allowed because it cannot be told apart from a ruleset that was deleted. Setting the variable gives that up knowingly. The usual reason is a single-writer organization, which cannot self-approve on GitHub and so sets the required review count to 0 on purpose. Everywhere else, set the required review count instead and leave this unset.
The workflow reads the Azure identity from the AZURE_* variables only. A
repository moving up from an older engine has ARM_* and ENGINE_APP_* values
to clean up; see Upgrading to v9.
Repository secrets¶
Set under Settings, Secrets and variables, Actions, Secrets.
| Secret | Required | Purpose |
|---|---|---|
TFPR_CHECKS_APP_PRIVATE_KEY |
yes | Checks App private key. Signs the engine's check rows. An environment secret on plan and apply, never a repository secret, which any branch workflow can read (on GitHub Free, where a private repository has no environment secrets, it stays at repository level). Set by the bootstrap when TF_VAR_checks_app_private_key is exported. |
INFRACOST_API_KEY |
for the cost gate | Hosted pricing API key. Until set, the infracost gate notes it and skips. It reaches the gate only when the default branch's projects.yml lists it under extra_env, as the template does. |
GitHub Actions provides GITHUB_TOKEN; you do not set it. It posts the comments
and drift issues. The checks App writes the check rows.
Environments¶
Two GitHub environments on the repo, each with an Azure federated credential:
| Environment | Identity | Used by |
|---|---|---|
plan |
Reader, and Storage Blob Data Contributor on state | PR plan jobs, the unlock, and the daily drift plan and lock sweep. |
apply |
Owner, and Storage Blob Data Contributor on state | The apply job. |
Each environment carries its own AZURE_CLIENT_ID variable, pointing at that
environment's identity. The bootstrap sets both. It is an environment variable,
not a repository variable: a single repository-level value would give the plan jobs
the Owner identity, or the apply jobs the Reader one.
The OIDC subject binds the repository and the environment name, built with immutable
repository ids (repo:org@id/repo@id:environment:env) for repos created after
GitHub's rollout, so keep the names stable. If you must rename them, set
TFPR_PLAN_ENVIRONMENT and TFPR_APPLY_ENVIRONMENT and update the
federated credential subjects to match.
Branch protection¶
Make tfpr / merge-gate a required status check on the main
branch, and set the required reviews you want tfpr apply to respect.
The bootstrap provisions a require-approved-pr-to-main ruleset that requires an
approved pull request and, through its required_status_checks variable, the
merge gate. The variable defaults to ["tfpr / merge-gate"], pinned to the
checks App when checks_app_id is set, so a same-named check from a workflow
cannot stand in for it.
The cost gate key¶
The infracost gate uses the legacy infracost line. Get a static API key from the
Infracost dashboard. Give it to the bootstrap as TF_VAR_infracost_api_key, which
writes INFRACOST_API_KEY and adds infracost to TFPR_EXTRA_TOOLS. Or set the
secret yourself and set infracost_api_key_unmanaged = true in the bootstrap tfvars. See the gates for detail and the data
residency note.