Home / Projects / Orchestrata Ultimate / Decisions / ADR index / ADR-0077

ADR-0077: Terraform owns every Incus environment; the live dev, test and prod fleets are imported, not rebuilt

field value
Status Accepted — Accepted (ruling, Mohamed, 2026-10-08: "all environments must be imported")
Date 2026-10-08
Register factory (docs/adr, 4-digit ids)
Source docs/adr/0077-terraform-owns-every-incus-environment-and-the-live-fleets-are-imported.md — permalink at 3a9894e47 (unchanged on master since that commit)
Wiki register entry ADR-0077 (wiki status: Accepted)

← ADR-0076 · ADR-0078 →

The record

Status: Accepted (ruling, Mohamed, 2026-10-08: "all environments must be imported") · Date: 2026-10-08

Context

The Incus topology on the production host is described by three IaC layers that disagree, and by a shell script that is the one thing that actually built it. Measured on 2026-10-08 against origin/master b125d048f and the live daemon:

The live inventory terraform must own (projects, bridges, ACLs, the two project-scoped default profiles that give test/dev containers their nic, and 23 containers) was dumped from the daemon on 2026-10-08 and every container's config is EMPTY apart from image.*/volatile.* — the same minimal shape infra/README.md already documents for zero-diff import.

Decision (Mohamed, verbatim: "all environments must be imported")

  1. Terraform is the single source of truth for the Incus topology of all three environments — projects orchestrata-test and orchestrata-dev, bridges orch-prod-br/orch-test-br/orch-dev-br with their ACL bindings, ACLs orch-no-prod/orch-no-dev/orch-no-test, the two project default profiles, and every container in default (prod), orchestrata-test and orchestrata-dev. The shell provisioners keep only what terraform cannot express: service install and configuration inside a container, and Raft enrollment.
  2. Everything live is IMPORTED, never recreated. Acceptance for the import is tofu plan -detailed-exitcode → 0 (no changes) on the live host after import.sh runs. The HCL models the as-built minimal shape (lifecycle { ignore_changes = [image, running] }, no explicit root disk, nic devices exactly as the daemon reports them).
  3. State lives outside every checkout. The root's backend is local with path = "/var/lib/orchestrata/terraform/fleet.tfstate" — the host-owned state directory the install already bootstraps — so a worktree gc, a re-clone or a .gitignore can never lose it again (the September state was lost exactly that way). State backups land beside the existing /var/lib/orchestrata/backups.
  4. The drift gate fails loudly. check_infra_drift runs tofu (falling back to terraform only when it satisfies required_version), reads the state path above, and a MISSING state is a FAIL, never a skip. The health check runs on a user timer so drift is detected, not discovered.
  5. Out of scope, by name. rhbr0 and the four stale rh-* containers in default are retired, not imported (deletion is Mohamed's command). The orchestrata Incus project (codetools' SPEC-013 fleet) belongs to the codetools repo and is a separate question. incusbr0 and its unrelated containers are not Orchestrata's. infra/rehearsal keeps its isolated subnet by design; infra/rawmachine stays the fresh-host path.
  6. First managed change after zero-diff: boot.autostart = "true" is declared for every imported container and applied, and the four stopped prod nodes are started — the import's acceptance is measured BEFORE this change so the two are never confused.

Alternatives rejected

Consequences

Provenance

Mohamed, 2026-10-08, in the Claude Code session (Fable 5.1), after the orchestrator researched why the four stale rh-* containers were still on his plate and presented three positions (terraform authoritative for all fleets — recommended; shell provisioner authoritative; repair only). His ruling, verbatim: "all environments must be imported". Evidence: live daemon dump 2026-10-08 (incus list --project {default,orchestrata-test, orchestrata-dev} -f json, networks, projects, ACLs, profiles); find for state files over all filesystems (none); scripts/health_check.py:493-520 (skip-on-missing-state); infra/terraform/coordinators.tf (incusbr0); deploy/provision_environments.sh header (topology authority); ruling R4 in deploy/orchestrata-test/provision_test_fleet.sh:391-399.

No other ADR is named in this record.

Rulings cited

None.

Specs cited