Skip to content

feature request: support V2 API tokens for authentication #860

@mattctl

Description

@mattctl

Attempting to authenticate to netbox via a V2 API token (as introduced in netbox v4.5) results in an error message.

provider version: v.5.2.1
netbox version: v.4.5.2

Steps to reproduce:

# main.tf
terraform {
  required_providers {
    netbox = {
      source  = "e-breuninger/netbox"
      version = "~> 5.2.1"
    }
  }
}

provider "netbox" {
  server_url = <netbox-url>
}
# create a V2 token in the netbox UI
export NETBOX_API_TOKEN=<V2-token>
terraform init
terraform plan

Error message:

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: [GET /status/][403] status_list default {"detail":"Invalid v1 token"}
│ 
│   with provider["registry.terraform.io/e-breuninger/netbox"],
│   on providers.tf line 12, in provider "netbox":
│   12: provider "netbox" {
│ 
╵

V2 tokens are a significant security improvement over V1 tokens, which are stored in the database in plaintext.

Please consider adding support for authentication via V2 tokens - at the moment we are faced with an unfortunate choice between managing netbox via infrastructure as code, and keeping it up to date and secure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions