Mint netbox user-management token dynamically (#184)
ci/woodpecker/push/apply Pipeline was successful

The netbox engine admin token was rotated, so netbox_user_management (still on the static KV admin_token because user_mgmt_username is unset) now fails plan with 403 "Invalid v2 token". The vault-user-mgmt role already exists in Vault.

- set user_mgmt_username to admin so user management uses the Vault-minted netbox/creds/vault-user-mgmt token
- declare the vault-secrets-netbox provider in the generated root config
- import the existing netbox/roles/vault-user-mgmt role into state

Reviewed-on: #184
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #184.
This commit is contained in:
2026-11-17 23:06:43 +11:00
committed by BenVincent
parent 167879e0c7
commit aef0666da8
2 changed files with 12 additions and 4 deletions
+3 -4
View File
@@ -42,7 +42,6 @@ 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"
# NetBox superuser the user-management credential is minted for (via
# netbox/roles/vault-user-mgmt), so rotating admin_token does not break it.
user_mgmt_username: "admin"
+9
View File
@@ -35,6 +35,11 @@ provider "arrstack" {
address = local.vault_addr
}
import {
to = module.netbox_user_mgmt_role["netbox"].netbox_secret_backend_role.this
id = "netbox/roles/vault-user-mgmt"
}
terraform {
backend "consul" {
address = "https://consul.service.consul"
@@ -69,6 +74,10 @@ terraform {
source = "artifactapi.k8s.syd1.au.unkin.net/terraform-unkin/vault-secrets-arrstack"
version = "0.2.0"
}
netbox = {
source = "artifactapi.k8s.syd1.au.unkin.net/terraform-unkin/vault-secrets-netbox"
version = "0.1.0"
}
}
}
EOF