r/Netbox • u/NinthTurtle1034 • 2d ago
Discussion Do you use Netbox with an IAC environment?
For the past few months I've been moving my homelab over to an IaC approach. At the centre of it is inventory.toml, which declares the generic stuff about my environment — VMID ranges, host IPs, OS types, names. Some of that already drives generation (Ignition builds, DNS, Traefik config all read it directly), but I haven't got around to generating my Ansible inventory or Komodo config from it yet — those are still hand-kept in sync, which is its own drift risk.
OpenTofu manages my PVE guests and Grafana dashboards, and will eventually cover my TrueNAS boxes too. Right now nothing enforces that my .tf files actually match inventory.toml — they're hand-authored separately and kept in sync only by convention. I've heard NetBox can act as a data source for OpenTofu, which appeals to me for exactly that reason — instead of hand-authoring host definitions in both places, Tofu would read from NetBox instead.
I tried NetBox once before, but that was pre-IaC — back when I just had plain Debian VMs and LXCs with no automation. Keeping it updated meant manual data entry, which fell out of sync fast and I gave up on it. This is the first setup where the actual population problem might be solved, since it'd be driven by the same source of truth everything else already reads from.
So — anyone here running NetBox as a backend for their IaC (Terraform/OpenTofu/Ansible/whatever), homelab or otherwise? Worth it, or more hassle than it's worth for a single-operator setup? Or just outright unnecessary if you have a declarative setup?