Skip to content

fix(terraform): make apply resilient to interrupted upgrades - #17

Merged
dmitriyzhuk merged 1 commit into
mainfrom
infra/tf-apply-resilience
Jul 29, 2026
Merged

fix(terraform): make apply resilient to interrupted upgrades#17
dmitriyzhuk merged 1 commit into
mainfrom
infra/tf-apply-resilience

Conversation

@dmitriyzhuk

Copy link
Copy Markdown
Contributor

Follow-up hardening after two interrupted applies left the cluster needing manual repair (stuck argocd helm pending-upgrade + nodes left cordoned by mid-apply k3s upgrades).

  • helm_release argocd / argo_workflows / cnpg: add atomic = true, cleanup_on_fail = true, timeout = 900. A failed or slow upgrade now rolls back cleanly instead of getting stuck in pending-upgrade (which was blocking the next apply with "another operation in progress").
  • kube-hetzner: automatically_upgrade_k3s = false, automatically_upgrade_os = false. The in-cluster system-upgrade-controller was auto-upgrading k3s/OS, which cordons+drains a node and briefly bounces the API server; when that fired during a terraform apply the run was interrupted mid-upgrade and left a node cordoned. Node upgrades are now deliberate/supervised.

Verified locally (TF 1.10.5): fmt -check clean, terraform validate = Success against kube-hetzner 2.21.0.

Note: applying this will show the system-upgrade Plan resources being removed (turning off auto-upgrade) — non-disruptive. Nodes are already on v1.33.13.

Two interrupted applies left the cluster in a bad state: the argocd helm
release got stuck in pending-upgrade (blocking the next apply with "another
operation in progress"), and in-cluster k3s node upgrades that fired mid-apply
cordoned+drained nodes and briefly bounced the API server, then failed before
uncordoning.

- helm_release argocd/argo_workflows/cnpg: add atomic + cleanup_on_fail +
  timeout=900 so a failed/slow upgrade rolls back cleanly instead of getting
  stuck pending-upgrade.
- kube-hetzner: automatically_upgrade_k3s=false, automatically_upgrade_os=false
  so node upgrades are deliberate/supervised and don't cordon nodes during an
  unrelated terraform apply.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dmitriyzhuk
dmitriyzhuk merged commit 52756be into main Jul 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant