RouterOS #65: device roots (rb5009-a, rb5009-b, crs309) #111
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lab/iac!111
Loading…
Reference in a new issue
No description provided.
Delete branch "routeros-devicetrees-65"
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. Closes #65 (the apply-and-clean-week part runs at the cutover, #73; the objects ship suspended).
What lands
routeros/rb5009-a/,routeros/rb5009-b/: one state per device, instantiatingmodules/site+modules/router(index 0/1, vrrp_priority 200/100), tls block wired likerouteros/sim(www-ssl cert frompki-net-caosh/routerosviavault_pki_secret_backend_cert→routeros_system_certificate→ certificate binding on the existingwww-sslservice; the service itself stays bootstrap-owned, #64). Providers pinned:terraform-routeros/routeros ~> 1.99(lock: 1.99.1),hashicorp/vault ~> 5.6(lock: 5.13.0) - same pair as the sim lock.routeros/crs309/: first cut, no switch module exists. Inline L2 derived from site data: identity, NTP, VLAN-aware bridge, VLAN table frommodules/sitenetworks, trunks to the router pair (defaultssfp-sfpplus7/8, lab port plan; access ports empty until the #44 hardware map). Not sim-proven - the lab switch stand-in is a Linux bridge; verify on hardware at bench.hosturl = https://<var.routeros_host>(TF_VAR, pre-DNS runs override),username = terraform,passwordsensitive TF_VAR arriving from the controllervarsFromSecret (only*.tfvars.exampleplaceholders committed),routeros_versionpinned via var (7.25.1), no backend block - exactly what harbor/ vault/ declare; the tofu-controller injects state config.harbor/provider.tf:skip_child_token+auth_login_jwtatkubernetes-mini, roletf-routeros(SA already exists,vault/runners-k8s.tf).vault/untouched.task routeros:guard(scriptscripts/routeros-guard.sh): fails if a device root declaresrouteros_system_user,routeros_system_user_sshkeys,routeros_ip_serviceorrouteros_ip_address(type names verified against the 1.99 provider schema viatofu providers schema). Scans root .tf only - the module's www-ssl binding (day 2, #64) stays legal. Verified both ways: clean roots pass, an plantedrouteros_ip_address/routeros_system_useris caught with a pointer to adoption.md.task routeros:validateadded too (init -backend=false + validate + fmt per root).docs/routeros/adoption.md: one page in #66 shape - protected set, what roots own, reset-vs-import adoption,import { to = module.router..., id = "name=bridge" }recipe.Deliberate deviation from the suggested CA data source
The routeros provider's
ca_certificatetakes a file path, and the tf-routeros role's policy is issue-only (verified on the harness OpenBao:path "pki-net-caosh/issue/routeros" { capabilities = ["update"] }), sodata.vault_generic_secretonpki-net-caosh/cert/cawould 403 at plan time - and the verification anchor the proven flow uses is the lab root, not the zone CA (sim/main.tfpasses a root file,renewal-test.shandlab-router-certs.shverify against it; the leaf chains pki-net-caosh → pki-issue → lab root). Sovar.lab_root_ca_pathdefaults to/etc/lab-ca/root.crt, the lab-root-ca configMap the flux-clusters objects mount for the same runner (identical toVAULT_CACERT). If we later want a Vault read instead, the tf-routeros policy needs areadgrant - separate vault/ change, not here.Validation (no devices touched; registry reachable)
tofu init -backend=false && tofu validate→Success! The configuration is valid.in all three roots.tofu fmt -check -recursive→ clean in all three.tofu plan/applyanywhere; lab untouched.Open questions (for the coordinator)
vlan10-mgmt/vlan1001-legacy-mgmt+ addresses 10.30.10.2/.3, 10.16.1.61/.62. The #64 renderer must not put its day-1 address under one of those names/addresses (or bench prep removes it first) - documented in adoption.md.routeros-secretsKV (routeros-secrets/RB5009_{A,B}_PASSWORD,CRS309_PASSWORD,PPPOE_{A,B}_{USER,PASSWORD}) must be seeded before un-suspending; ESOrouteros-*-varsstay NotReady until then (flux-clusters PR).Lab verification pass run from workstation (2026-11-16): routeros:guard OK; both roots planned against live lab routers (r1 172.31.254.11, r2 .12, boot state, admin creds since #64 bootstrap has not run there yet): pure creates, 168 to add / 0 change / 0 destroy, no errors. Workstation plan recipe: scratch copy + override.tf nulling module.router tls (vault provider cannot configure outside the runner pod) + serviceaccount_token_path pointed at a dummy file (provider block evaluates file() even with all vault resources count=0 - worth knowing for bench docs). One env note: OpenTofu 1.13.9 returns exit 2 for a changes-present plan from -detailed-exitcode with zero diagnostics; empty plan gives 0. adoption.md's gate (expect exit 0) stays correct, just do not interpret 2 as an error. lab:router-check step 1 (REST over lab root) green on both; steps 2-7 red exactly for the day-2 config these roots own, as expected pre-apply (#74). Nothing merged, no apply performed.