# Mounts the netbox token secrets engine at "netbox" and writes its config. # The seeded NetBox admin token is sensitive and read from KV, not stored here: # kv/service/vault/au/syd1/secret_backend/netbox/config # -> key: admin_token (required) the SINGLE static admin credential # # admin_token must be a BARE NetBox token with NO scheme prefix: do not prepend # "Bearer " or "Token ". NetBox infers the version from the value's nbt_ prefix, # so one bare token authenticates under either scheme; the plugin adds the keyword # itself. A prefixed value yields a malformed header + 403. # # Populate admin_token with a purpose-built NetBox superuser token (add_user + # add_token + grant_token, or superuser) BEFORE applying, then run # `vault write -f netbox/config/rotate` after the first apply so only Vault holds # the live admin token. # # Only ONE static admin token exists. netbox_user_management does NOT re-read this # token; instead the engine mints it a short-lived user-admin token per apply from # netbox/roles/vault-user-mgmt (see user_mgmt_username below), so rotating # admin_token never breaks user management. Set user_mgmt_username to the # pre-existing NetBox superuser the static admin_token belongs to (or another # superuser). Leaving it unset falls back to using admin_token directly, which is # only a bootstrap/degraded path and breaks after rotation. # # Bootstrap ordering: the vault-user-mgmt role must exist before the netbox # provider is configured from its creds, so on a brand-new backend apply the mount # + role first (e.g. `tofu apply -target=...netbox_secret_backend # -target=...netbox_user_mgmt_role`) once, then apply normally. # # token_version 2 is the NetBox 4.6.5 default and requires API_TOKEN_PEPPERS to # be configured on the NetBox server; set token_version: 1 here if the server # has no peppers. token_version does NOT change how the plugin authenticates its # own calls (that scheme comes from the admin_token value's nbt_ prefix); it only # sets the version of the per-user tokens the engine mints. It must still MATCH # the admin_token kind: nbt_ v2 token -> token_version 2; bare v1 token -> 1. # # The mount uses ignore_changes=[token], so editing KV alone does NOT reach the # live mount. To push a corrected/rotated admin token into a running mount: # vault write netbox/config token= # (netbox_url/token_version are preserved on a partial update). Do NOT -replace # the mount to force a re-read - that recreates it and drops all roles/config. description: "NetBox ephemeral scoped API token engine" netbox_url: "https://netbox.k8s.syd1.au.unkin.net" token_version: 2 request_timeout_seconds: 30 # Set to the pre-existing NetBox superuser admin_token belongs to, to mint the # user-management credential dynamically (recommended). Until set, user management # uses admin_token directly and a check block warns that rotation will break it. # user_mgmt_username: "vault-netbox-admin"