tofu: rename from terraform, state in its own bucket, Loki buckets
All checks were successful
nixos / nixos (push) Successful in 34s

The infrastructure is applied with OpenTofu; name it so. terraform/
becomes tofu/, the files end in .tofu (OpenTofu 1.8+ prefers them), the
local variables file is secrets.auto.tfvars, and both servers carry
managed_by=opentofu (an in-place label change).

The state moved to new buckets asxpio-tofu-main/-repl, key
tofu/state/tofu.tfstate, with `tofu init -migrate-state`; a plan against
it shows no changes. The old asxpio-terraform-* buckets stay, renamed
in the config with moved blocks, until the new state has been used for
a while.

asxpio-loki-main, created by hand, is adopted with an import block, and
a new asxpio-loki-repl in fsn1 receives it in the daily replica, which
now also copies the new state bucket instead of the old one.

What keeps the Terraform name is OpenTofu's own: the `terraform {}`
block and .terraform.lock.hcl.

Assisted-by: Claude:opus-5-5
This commit is contained in:
Sergei Poljanski 2026-11-17 09:42:53 +04:00
commit 796331815d
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -5,7 +5,7 @@ The plan and the runbook. Delete this file when the last step is done.
**End state:** both servers run NixOS built from `nixos/`, deployed by
`.forgejo/workflows/nixos.yaml`; services are native NixOS services
where nixpkgs has a module and Podman containers otherwise; no Docker
daemon, no Ansible; infrastructure in `terraform/` is applied with
daemon, no Ansible; infrastructure in `tofu/` is applied with
OpenTofu. The servers themselves stay: they are billed below today's
list price, so each one is converted **in place** and never recreated.
@ -43,7 +43,7 @@ Phase 2 took 18.5 minutes of downtime (04:52–05:10 UTC) plus a minute
for the reboot. WireGuard was down from 04:52 to 05:04 and came back with
the first `test` activation; the dead-man reboot was not needed. Found on
the day: nixos-infect's bootstrap system only accepts the keys Debian's
root had (the RSA key from `terraform/keys.tf`); on the new system root
root had (the RSA key from `tofu/keys.tofu`); on the new system root
takes the `me@asxp.io` key. The disk reached 90% with the old Docker
store under `/old-root`; deleting its image layers brought it to 71%.
@ -112,7 +112,7 @@ Everything here can be done while Ansible still runs production.
2. **OpenTofu.** Once, from a workstation:
```sh
cd terraform
cd tofu
tofu init -reconfigure
tofu plan # expected: only the new user_data output
tofu apply # writes the output; changes no resource