The Terraform State Had No Copy Where the Standby Needed It
A review of our Terraform found disciplined code and one real gap: the state file had no remote backend and was correctly gitignored, so the standby host's clone of the repo held no copy. A six-hourly one-way sync fixed it, with its staleness stated.

Key Architectural Takeaways
- Gitignored state means a fresh clone carries code for every resource and no knowledge that they exist.
- A one-way, timed sync to the standby is a proportionate fix when state changes rarely.
- State the staleness window plainly: six hours, not tied to apply events.
The challenge
We ran a structured review of our Terraform using a failure-mode checklist: identity churn, secret exposure, blast radius, drift and similar. The code held up unusually well. Every resource had a lifecycle guard backed by a comment about a real incident.
The one real gap
terraform.tfstate had no remote backend, and it is correctly gitignored. The standby management host's clone of the repository therefore contained none of it. In a real hypervisor outage, a fresh recovery session would have Terraform code for all 26 managed containers and one lab VM and no state telling Terraform that any of them existed. An apply from that position would try to create things that are already there.
The fix
A small sync script and a systemd timer, following the pattern of an existing host-local timer:
- One-way copy of the state file to the standby, by
scpand an atomic rename so the standby never sees a half-written file. - Every six hours.
- Deliberately not a live replica, matching the standby's own design principle of "same core ingredients, not a mirror".
Verification
We ran the sync manually first, before enabling the timer: 129,214 bytes transferred, and sha256sum identical on both hosts. Then we enabled the timer and confirmed it was enabled and active, with the next fire about six hours out.
The limitation we accepted
The sync is periodic, not tied to terraform apply, so the standby's copy can be up to six hours stale. For infrastructure whose Terraform rarely changes, that is a reasonable trade, and it is written down so a recovery operator knows to compare the state with reality before applying.
Takeaway
A recovery plan has two halves: what to build, and what you already have built. State is the second half, and it is the part nobody commits.
Some of what's described here is a design that hasn't been fully tested yet; those parts say so in the text.