feat(backups): include the Terraform state in every backup run (#220 step 3) #222
Loading…
Reference in a new issue
No description provided.
Delete branch "jfraeys/feat/state-snapshot-backup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The state object had no backup of its own (#220). infra-state-snapshot.sh lists the backend bucket, downloads each workspace's state (env://infra/terraform.tfstate) with curl --aws-sigv4 into /var/lib/infra-backups/terraform-state/.tfstate (0600), validates it as JSON, and the existing restic run then carries it to the primary and the secondary repo. Failure marks the dumps component failed, so the backup reports DEGRADED.
Checked: a run against the real bucket into a temp dir (6 workspaces, files 0600, deleted afterwards); a raw ':' in the key fails the signature (403) while %3A works, and the script and its test encode it; test-state-snapshot.sh (8 cases with a fake curl, added to lint.yml); the env template renders correctly with the flag on, off and with an empty bucket; ansible syntax check of services.yml.
Not checked: the script on the real services host (needs a deploy), and the new curl version there (Debian 12 ships 7.88, which supports --aws-sigv4).
Enabled for production services only via backups_state_snapshot_enabled in inventory/host_vars/services.yml; staging and DR hosts skip it. Roles change: staging, promotion, then ./infra deploy --tags backups --limit services (not on the new OVH node before cutover).
Part of #220.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ