Add the netbox backend and terraform-infra role #117
Reference in New Issue
Block a user
Delete Branch "benvin/netbox-user-management"
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?
Why
How
config/netbox_secret_backend/netbox.yamlto mount the engine atnetboxand point it at the syd1 NetBox URL; the admin token is read from KV, not stored here.config/netbox_secret_backend_role/netbox/terraform-infra.yamlas the single declarative source for the terraform-infra identity: filename-derived role name and NetBox username, write access, short TTLs, and an inline permissions block. Nothing in the file repeats the filename.policies/netbox/creds/terraform-infra.yamlletting the terraform-infra AppRole and its Woodpecker k8s role readnetbox/creds/terraform-infra; it attaches to nothing until the separate terraform-infra Vault onboarding lands.Dependency order
CI note
kv/data/service/vault/au/syd1/secret_backend/netbox/config(a NetBox token with add_token + grant_token / superuser). Seeding that path is an environmental prerequisite, not a code defect; everything else validates.CI status:
pre-commitgreen (tofu fmt/validate, tflint, terragrunt hcl fmt, yamllint).planred with:This is the seeded NetBox admin token being absent from KV at plan time, not a code defect:
.../secret_backend/netbox/config, keyadmin_token).netbox_secret_backend.this; this PR's plan (pipeline 150, 02:19Z) hit "no secret found" for the same path, so the seed was present earlier and is not present now.tofu planof the module is green, and thee-breuninger/netboxprovider is lazy (no NetBox call at plan withskip_version_check = true).Unblock: seed
kv/service/vault/au/syd1/secret_backend/netbox/configwith keyadmin_token(a NetBox token carrying add_token + grant_token / superuser) before this plans/applies - the same seed #115 needs to apply. Rotation caveat: aftervault write -f netbox/config/rotatethe live engine token diverges from the KV seed, so keep a valid management token at that KV path for this module's provider to keep managing users.Refactored to infer the NetBox user from the engine role config: config/netbox_secret_backend_role/netbox/.yaml is now the single source per identity (filename = engine role name = NetBox username; body = write_enabled/ttl/max_ttl + inline permissions). config.hcl derives netbox_username from the filename, the netbox_username field is dropped from the yaml, and config/netbox_user is deleted. Both the engine-role module and netbox_user_management consume the same map keyed by config path.
CI on
702dc6c: pre-commit green (tofu fmt/validate, tflint, terragrunt hcl fmt, yamllint). plan red with the same pre-existing environmental blocker as before -no secret found at kv/data/service/vault/au/syd1/secret_backend/netbox/config. This refactor does not touch that data source (it reads the same admin_token path the engine reads), so the failure is the unseeded KV admin token at plan time, not a code defect. Seed that KV path (NetBox token with add_token + grant_token / superuser) - the same seed #115 needs - to turn plan green.Manage NetBox service users declaratively for the netbox engineto Add the netbox backend and terraform-infra role