Skip to content

Upgrades

How to move a customer repository to a newer engine, toolchain, module or library version, and the release-specific steps for each engine major. What is pinned today is on Versions; what changed per release is in the release history.

How to upgrade the engine

  1. Read the release notes for the target tag. They call out anything a consumer must change. Copy the callers from the example files at that tag, not only the pins: from v12.5.0 the engine warns about any difference in the parts it depends on (see Troubleshooting).
  2. Bump the five pins in the five caller files, in one commit: uses: ...@vX.Y.Z everywhere. A major release takes two pull requests: the ops and drift callers first, then the PR, unlock and review callers, because a dispatched run uses the ops caller on main. See Upgrading to v8 for why; the move to v9 also has caller edits and license variables, see Upgrading to v9. The repository invariants allow exactly that intermediate state and fail every other mix of releases.
  3. Open a pull request.
  4. Smoke test the new engine. A pin bump on its own changes no Terraform, so the pull request plans nothing and proves nothing. No pre-merge path plans on the new pin at all: the dispatch action hands the pull request to the ops caller that is already on main, and the /plan comment path runs from main too, so both silently test the old engine. So:

    • Merge the bump first, then dispatch drift.yml, which plans every unit on the new pin.
    • Or, after merging, open a throwaway pull request with a change under a unit and let it plan; close it unmerged.
  5. Get the required reviews, comment /apply if the change needs one, and merge.

Roll back by reverting the pin commit.

Renovate

With the Renovate GitHub App installed on the repository, .github/renovate.json opens the bump pull requests in step 2 for you:

Engine release Pull requests
Minor or patch One, renovate/tfpr-engine, all five callers
Major Two. Step 1, renovate/major-tfpr-engine-major-1-ops-drift: tfpr.yml and drift.yml. Step 2, renovate/major-tfpr-engine-major-2-pr-unlock: tfpr-pr.yml, tfpr-unlock.yml and tfpr-review.yml

Merge step 1 first, with any caller edits the release notes ask for. Renovate moves pins only: a caller a release adds, like the v11 review caller, goes into the step 2 pull request by hand. Step 2 fails the pin check until step 1 is on main; Renovate then rebases it and the check passes. The smoke test in step 4 still applies: a Renovate pull request plans nothing on the new pin either.

Install the App with access to the customer repository only. The configuration enables only the engine pin manager, so Renovate proposes no other updates. It also opens its Dependency Dashboard issue, which lists the pending bumps.

Upgrading to v8

A pushed pull request dispatches the ops caller that is already on main, and v8 changes that caller's inputs. A single pull request that bumps all four callers therefore dispatches the old ops caller with inputs it does not know, no merge gate is ever written, and the ruleset blocks the merge. Bump in two pull requests instead:

  1. The ops and drift callers (tf-pr-ops.yml, drift.yml): new pins, and the dispatch inputs replaced as in The PR-ops engine. This pull request still runs on the old PR caller and merges normally. Until the next one merges, a push to an open pull request dispatches nothing that runs; comment /plan instead.
  2. The PR and unlock callers (tf-pr-ops-pr.yml, tf-pr-ops-unlock.yml): new pins, no with: inputs, and the PR caller's permissions reduced to contents: read and actions: write. This pull request's checks already come from the new path.

Then re-apply the bootstrap: it limits plan and apply to the default branch, writes the checks App key on both, and deletes the repository-level copy, which any branch workflow could read. Do it after the bump, because older engines read the key from the repository in the PR run.

See The PR-ops engine for the full caller files.

Upgrading to v9

v9 keeps the ops caller's workflow_dispatch inputs, so one pull request can bump all four callers. Before or with the bump:

  1. Set the repository variables TFPR_LICENSE and TFPR_ENTITLEMENT. The bootstrap writes both from tfpr_license and tfpr_entitlement (scripts/onboard.sh -f <path to the customer tfvars> fetches the entitlement); gh variable set is the fallback. Check that AZURE_TENANT_ID is the tenant the entitlement is bound to. See License.
  2. If the repository still relies on ARM_* secrets for the Azure identity, set the AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_SUBSCRIPTION_ID variables. The bootstrap sets them.
  3. Allow the runners to reach the hosts in License requirements, including the revocation list host.

The caller edits, in the ops and drift callers (tf-pr-ops.yml, drift.yml): remove the engine_ref line under with: (the drift caller then has no with: block), and remove ENGINE_APP_PRIVATE_KEY from secrets:, keeping only TFPR_CHECKS_APP_PRIVATE_KEY and INFRACOST_API_KEY. The PR and unlock callers change only their pin.

The bump pull request is still planned by the v8 ops caller on main, which needs the engine App credentials. Delete the ENGINE_APP_CLIENT_ID variable and the ENGINE_APP_PRIVATE_KEY secret only after the bump has merged.

Upgrading to v10

v10 keeps the ops caller's workflow_dispatch inputs, so one pull request can bump all four callers; the reference repositories still bump in two, so the second pull request runs on the new ops caller from main. Before or with the bump, on the default branch:

  1. If the repository runs the cost gate, add a top-level extra_env list to projects.yml naming INFRACOST_API_KEY. Without it the cost row reads "skipped, no INFRACOST_API_KEY" from the first v10 run. See The extra_env block.
  2. Move any hook that posted to GitHub with GH_TOKEN to a workflow step after the engine job. Hooks no longer see it.
  3. Check the review setup. An /apply now needs an approving review on the head commit from a user with write access. A single-writer repository that relied on required_approving_review_count = 0 and TFPR_ALLOW_UNREVIEWED_APPLY keeps working, but the recommended shape is one required review and a second account that can give it; the bootstrap's apply_approvers adds it to the approvers team.
  4. Scope the deploy identities below the tenant root if they are not already: the bootstrap's management_group_scope_id takes the ALZ parent group or the alz group itself. v10 removes the paths a writer could use to reach the apply identity without a review, and a narrow scope bounds what a reviewed apply can do.

Pin v10.1.0 or later, never v10.0.0: v10.0.0 asked for a hand-written map of shared files, which v10.1.0 derives from Terragrunt itself.

Upgrading to v11

v11 adds a review option to the ops caller's command input and a fifth caller, tf-pr-ops-review.yml, that dispatches it. A review caller that dispatches to an ops caller without the option fails with HTTP 422, so bump in two pull requests:

  1. The ops and drift callers (tf-pr-ops.yml, drift.yml): new pins, and review added to the ops caller's options: options: [plan, apply, unlock, review].
  2. The PR and unlock callers (tf-pr-ops-pr.yml, tf-pr-ops-unlock.yml): new pins. Add tf-pr-ops-review.yml, copied from the template (named tf-pr-ops-review.yml before v12), and add it to the step 2 rule's matchFileNames in .github/renovate.json.

No variable, secret or permission changes. To check the result, approve a pull request that plans a unit: its tf-pr-ops / approval row turns green within about 20 seconds, without a new plan.

Upgrading to v12

v12 renames the engine to tfpr, Terraform PR operations. The public repository is nrit-solutions/tfpr, the caller files are tfpr*.yml, the checks are tfpr / ..., and the comment commands are tfpr plan, tfpr apply, tfpr unlock and tfpr help. A /plan, /apply, /unlock or /help comment runs nothing in v12 and gets a reply naming the new form.

GitHub redirects a renamed repository for git and downloads, but not for a reusable workflow's uses: line, so a v11 caller stops loading. Renovate cannot open the bump either, because the package name changed. Bump by hand, in two pull requests, with the required check moved in between:

  1. Rename tf-pr-ops.yml to tfpr.yml and point it and drift.yml at nrit-solutions/tfpr/...@v12.0.0. A v11 run can no longer write tf-pr-ops / merge-gate, so this pull request merges with an organization admin bypass of the ruleset.
  2. Change the required status check from tf-pr-ops / merge-gate to tfpr / merge-gate: set required_status_checks in the customer tfvars (the bootstrap default is the new name) and apply -target='github_repository_ruleset.require_approved_pr'. The actions allow-list must allow nrit-solutions/tfpr@* and nrit-solutions/tfpr/*; the bootstrap default does.
  3. Rename tf-pr-ops-pr.yml, tf-pr-ops-unlock.yml and tf-pr-ops-review.yml to tfpr-pr.yml, tfpr-unlock.yml and tfpr-review.yml, point them at nrit-solutions/tfpr/...@v12.0.0, and take .github/renovate.json and .github/scripts/check-repo-invariants.sh from the template. This pull request goes through the new gate.

No variable, secret or permission changes.

What bumps the engine major

The caller contract is what a consumer repository has to provide. A breaking change to any of it bumps the major version:

  • workflow inputs,
  • secrets the workflow expects,
  • hook conventions, including the meaning of $TFPR_ENGINE_DIR and the step seams,
  • required caller-side repository variables,
  • required GitHub environments.

Everything else is a minor or a patch. See projects.yml schema and Hook and step model for the surfaces this covers.

Upgrade one thing at a time

Bump one module, one library, or the engine per pull request. The plan diff stays readable, and a revert is one commit. Upgrading everything at once turns a readable diff into a wall of noise.

The process is the same in each case:

  1. Change the version, ref, or the caller pins on a branch.
  2. Open a pull request. The engine plans the impacted units and posts the diff.
  3. Review the plan and the gate output.
  4. Comment /apply after approval.
  5. Roll back by reverting the change and applying again.

See Plan and apply.