Lesson 10 of 13 · 14m
You Can't Restore What You Never Backed Up
IaC rebuilds compute, not state; the backup inventory comes from a rebuild drill on a blank VM, not from memory.
Restores fail on the thing nobody wrote down. The database was backed up; the TLS private key was not. The app deploys cleanly; the DNS zone export never existed. The inventory problem is that state hides in places that feel like configuration — and configuration is exactly what nobody backs up because "it's all in git."
The IaC blind spot
The wrong mental model is: everything is Terraform/Ansible/git, we rebuild from source. IaC rebuilds compute — packages, topology, service definitions. It does not rebuild state, and state lives precisely where the disk died. Walk a real host and count what is stateful-but-not-code:
/etcon the pet VM that predates the Terraform — nginx confs hand-tuned in 2021, cron entries somebody added at a shell prompt, thesshd_configwith the port everyone forgot.- TLS private keys and ACME account keys. Lose the host keys too and every SSH client screams
REMOTE HOST IDENTIFICATION HAS CHANGEDat your customers on day one of the rebuild. - The DNS zone itself. Managed DNS lives in the provider, not your repo — until the provider account is the thing that died. Zone exports (Route53, Cloudflare API,
dig axfrwhere it's allowed) are a backup. - Secrets stores: Vault's Raft data, etcd snapshots (
etcdctl snapshot save), SOPS-age key files. Encrypted, sure — and still data that can be deleted. An age key file lost with the host turns every SOPS-encrypted secret in the repo into ciphertext confetti forever. - Terraform state: it's an inventory of the real world plus cleartext secrets. Lose it and your infra is orphaned resources that
terraform planhas never heard of. - CI secrets and deployment credentials living only in a SaaS console.
- GitHub itself:
git clonecovers code. Issues, PRs, reviews, repo settings, branch protections, Actions secrets, releases metadata — none of that is in the repo.gh apiexports,git clone --mirrorfor the refs, scheduled dumps to the same offsite domain as everything else. - Monitoring configuration — the alerts that would have told you something was on fire, now gone with the fire.
- Deployment-side reachability: CI runner registrations, deploy SSH keys, the kubeconfig that lets you reach the cluster you need to rebuild.
- Third-party consoles: Stripe webhook endpoints and product catalog, Cloudflare rules, email provider settings — the config surface of services you don't run.
- The
.envfile and systemd unit overrides (systemctl editoutput lives in/etc/systemd/system/<unit>.d/) that never made it into a repo because "it's just one line." - The backup-job definitions themselves — the systemd timer, the script holding
RESTIC_REPOSITORYandRESTIC_PASSWORD, the repo URLs. Lose the host and you keep the repositories but lose the map to them. - Container volume state:
docker volume lsis named volumes holding databases and uploads that live outside the compose file. - Operator dotfile state nobody imports into IaC:
~/.ssh/authorized_keyson ops boxes, locally installed certs,known_hostsentries that keep automation from stalling on a prompt. - License files and activation state on software that won't reinstall cleanly without them.
How the inventory actually gets built
From a drill, not from memory. The empirical method: rebuild the service onto a blank VM from your IaC alone, boot it, and write down everything that is missing or wrong. That list is the backup inventory — generated by the same procedure a real disaster would run. Every item on it gets a named backup path: dumped, exported, replicated, or pulled into the file backup.
Then keep it honest:
- Quarterly re-run of the rebuild drill; new state creeps in constantly.
- Every stateful thing names its backup mechanism in the runbook — not "covered by the nightly job," a specific artifact.
- Third-party config gets an export where an API exists, and a runbook note where it doesn't.
- The inventory includes where the secrets that unlock the backups live — the list is useless if the repo password only existed on the dead host.
- And the inventory itself lives offsite: a map stored only on the host it describes burns with the territory.
You cannot restore what you never backed up, and you cannot back up what you never inventoried. The rebuild drill is how you find out which sentence of that pair is currently lying.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Self-Hosting Prometheus and Grafana: Infrastructure Monitoring That Actually Works
Build a production-grade monitoring stack with Prometheus and Grafana from scratch. Covers architecture, Docker Compose deployment, Node Exporter, alerting with Alertmanager, PromQL from basics to advanced, pre-built dashboards, and everything SudoSecurity uses to monitor its own infrastructure.
Zero Trust Everything: The Complete Guide to Self-Hosting Teleport for Secure Infrastructure Access
SudoSecurity runs Teleport internally for everything — admin panel access, secure database connections, Kubernetes, and zero-trust philosophy across our entire team. This is the complete technical guide to installing, configuring, and running your own self-hosted Teleport cluster from scratch.
Running a Minecraft Network: Four JVMs, One Box, and the Settings That Lie to You
Four servers on one host means four JVMs each sizing its thread pools for a machine it does not own. The measured cost of that, the systemd ordering that guarantees nothing, and the throttle that switches itself back on when your forwarding breaks.
Building a Minecraft Network: Four Servers Pretending to Be One Place
A proxy, a lobby, an SMP and a PvP arena is four JVMs that know nothing about each other. What actually has to be shared, why your permissions don't follow players, and the two LuckPerms defaults that silently share nothing at all.