Files
terraform-netbox/modules/netbox/providers.tf
unkin-agent 4c9bfb0448
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline failed
Read the minted NetBox credential from the engine's token field
The engine returns it as "token"; "netbox_token" does not exist, so the
plan failed with Invalid index before reaching NetBox.
2026-10-03 15:40:11 +10:00

20 lines
732 B
Terraform

provider "vault" {
address = var.vault_address
# The woodpecker_terraform_netbox role cannot mint child tokens
# (auth/token/create is denied); use the login token directly.
skip_child_token = true
}
# NetBox API token: minted per run by the vault-plugin-secrets-netbox engine
# (netbox/creds/terraform-netbox), lease-revoked when the run ends. The engine
# returns the credential as "token" (alongside token_scheme/authorization); it is
# a bare nbt_ v2 value, which NetBox accepts under either Authorization keyword.
data "vault_generic_secret" "netbox" {
path = "netbox/creds/terraform-netbox"
}
provider "netbox" {
server_url = var.netbox_server_url
api_token = data.vault_generic_secret.netbox.data["token"]
}