RouterOS: nightly drift detection against Terraform (no config backups) #72
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lab/iac#72
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Part of #43. Rewritten 2026-11-17: drift detection, not backup.
Premise
Routers are fungible. Every setting flows through the Terraform pipeline; anything the provider can't express gets added to the lab fork (
lab/terraform-provider-routeros). The rest is code too: the protected set lives inrouteros/bootstrap/bootstrap.rsc.tmplplus OpenBao, and packages,device-modeand RouterBOARD firmware are bench-runbook steps (later #71). Device-generated state (SSH host keys, dynamic leases, conntrack, the PPPoE session) is disposable. Replacing a router is netinstall, then the bootstrap, then the render (#70), proven by the gate on all three devices. So nothing on a router needs a backup, and there are no blessed exports in git.What this issue enforces is the rule: nobody changes a router outside the pipeline.
Shape
/export terse, normalize it (render.py normalize: one line per command, sorts onlySORTABLE_MENUS, ordered menus copied, #67), and compare it with the render of the current root at master, normalized the same way. The reference is Terraform itself, the same comparisongate.shmakes, so there's no blessed copy to maintain. Out of scope: menus Terraform deliberately doesn't own (EXCLUDED_MENUS, the protected set) and the known-benign linesgate.shalready ignores. Any other difference raises an alert (Gotify, plus a metric for clusters#1722). This is also the "#008 round-trip" tail that #69 handed over.system,info,account) to VictoriaLogs. Alert whenever a config change is logged by a user other thanterraform-*(RouterOS logs "... changed by "), and on anyadminlogin, since admin is break-glass only.render.py coveragealready fails on objects in Terraform-owned menus that no resource holds. Run it in the nightly job too, so an object added by hand is caught even in a menu the export comparison normalizes.Done when
readpolicy is enough for/export, otherwise a dedicated read-only user on the same two-slot pattern).adminlogin.normalizeor the ignore list, never by blessing an export.Refs #67 (normalize), #69 (round-trip tail), #70 (render/gate), #139 (monitoring identity, mktxp), #147 (credentials).
RouterOS 010: Periodic /export backstop for unmanaged configto RouterOS: nightly drift detection against Terraform (no config backups)