feat(terraform): default every stack to one Terraform version [NOJIRA] - #344
tobias0106 wants to merge 1 commit into
Conversation
Monta runs three Terraform versions today: 1.5.7 (Cloudflare, Grafana), 1.9.8 (terraform-core) and 1.13.5 (ClickHouse, all of db-access). The workflow had no opinion and hard-failed when a repo carried no .terraform-version, so every repo had to state it. Default to 1.13.5 — already the majority — as the last fallback, after the input, the stack file and the root file. A stack that must differ keeps its own .terraform-version. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Closing — the default does not earn its place. It was sold as one place to bump the version for all three repos, but callers pin a commit SHA, so a new default only reaches a repo when that repo re-pins. It delivered none of that centralisation while adding a third source of truth. It also removed a useful hard-fail: a repo with no The existing order — |
Monta runs three Terraform versions today:
terraform— Cloudflare, Grafanaterraform-core— all 11 stacksterraform— both ClickHouse stacks;terraform-db-access— all 56terraform-stack.ymlhad no opinion: it read.terraform-versionand hard-failed if a repo carried none, so every repo had to restate the answer.What changes
DEFAULT_VERSION: "1.13.5"becomes the last fallback. Resolution order is now:terraform-versioninput.terraform-versionin the stack directory.terraform-versionat the repository rootSo the common case is a repo with no version file at all, and a stack that must differ keeps its own
.terraform-version— whichtfenvandasdfread too, so a local plan matches CI. The resolved version and where it came from are now logged.Why 1.13.5 and not 1.16.2
1.16.2 is current, but 1.13.5 is what 58 of Monta's 71 stacks already run in production. Aligning and upgrading are two different changes; this one is the alignment, and picking a version already proven here makes it a no-op for db-access and ClickHouse. Bumping the default to 1.16.x afterwards is then a one-line PR — which is the point of having a default at all.
This does not upgrade anything by itself
A repo picks up a new default only when it re-pins this workflow, so stacks still move one at a time. That matters because the first apply on a new version rewrites the state format and older Terraform cannot read it back — the upgrade is one-way per stack.
Rollout, each its own PR and each its own apply:
terraform-db-access— nothing to do, already 1.13.5.monta-app/terraform(feat: add configurable repository name for v2 workflows #168) — keeps its per-stack files; delete the two ClickHouse ones when re-pinning, and drop the 1.5.7 pins as Cloudflare and Grafana are bumped.terraform-core— one root file at 1.9.8 covering 11 stacks; bump it per stack, or all at once if a plan on 1.13.5 comes back clean.🤖 Generated with Claude Code