On November 5, 2026, the first failure looked like authentication. After switching to a NetBox v2 API token, terraform plan stopped at the provider’s status request:
GET /status/: 403 Invalid v1 token
That error was useful, but it was not the whole incident. Once the provider accepted the token, the plan got farther: it read the NetBox cluster, began refreshing existing virtual machine records, and timed out waiting for their HTTP response headers. Treating the second failure as more of the first would have sent the investigation toward the wrong fix.
The Error Moved
The Terraform configuration used e-breuninger/netbox v5.5.0. NetBox’s API authentication documentation specifies Authorization: Bearer for the complete v2 token rather than the legacy Token scheme; the provider added v2 support in v5.3.0. After that was corrected, the earlier Invalid v1 token response disappeared. A successful GET /api/status/ and the provider’s cluster lookup showed that authentication and at least some NetBox reads worked.
The next plan did not complete. Multiple netbox_virtual_machine resources failed on requests shaped like this:
GET /api/virtualization/virtual-machines/<id>/
context deadline exceeded (Client.Timeout exceeded while awaiting headers)
The provider also warned that its v5.5.0 compatibility tests covered NetBox releases only through 4.4.10, while this server reported 4.7.4. That was a compatibility warning, not the fatal error, and it did not prove a version mismatch caused the latency. Reducing Terraform to -parallelism=1 still produced VM-detail timeouts. Increasing NETBOX_REQUEST_TIMEOUT to 90 seconds did not make the plan reliable either.
I needed to measure the same endpoint the provider was trying to read. A quick response from /api/status/ was a weak test of a VM refresh.
Change the Response Shape, Not the Token
I compared three authenticated GETs for one VM from the same client and token. These were individual observations, not a latency distribution:
| VM-detail request | HTTP result | Time to first byte |
|---|---|---|
Full /api/virtualization/virtual-machines/<id>/ |
200 | 36.59 s |
Same endpoint with ?fields=id,name |
200 | 0.45 s |
Same endpoint with ?omit=config_context |
200 | 0.45 s |
The measurements were made with a command of this shape, using an environment variable rather than printing the token:
curl -sS -o /dev/null --max-time 60 \
-w 'HTTP %{http_code}; first byte %{time_starttransfer}s\n' \
-H "Authorization: Bearer $NETBOX_API_TOKEN" \
'https://<netbox-host>/api/virtualization/virtual-machines/<id>/?omit=config_context'
The full request returned HTTP 200, so this was not an across-the-board authorization failure. The filtered request showed that finding the VM by ID was fast. Omitting config_context while leaving the rest of the response intact narrowed the expensive path much more specifically than ?fields=id,name alone. NetBox documents both fields and omit as ways to control response shape and the cost of related-field serialization.
That comparison implicated inclusion of config_context in the response, but it did not identify the server-side mechanism. Cache population, context rendering, database work, or another dependency of that field still needed NetBox-side logs and measurements. Nor did one fast omission prove every VM response would behave identically. The evidence was sufficient to give the NetBox administrator an exact endpoint, query variation, and timing to investigate; it was not proof that changing Terraform module code would repair the server.
A Preflight Could Ask a Smaller Question
The VM collision preflight had a different job from Terraform’s managed-resource refresh. It only needed to know whether a planned VM name already existed, not retrieve the full VM representation. Its original lookup fetched the full result and encountered NetBox HTTP 504 responses during the investigation. After the lookup was narrowed to:
GET /api/virtualization/virtual-machines/?name=<name>&fields=id,name
the preflight completed its NetBox, vCenter, DNS, and network checks. It correctly flagged collisions in the saved test plan. That plan was old and described VMs that already existed, so the result demonstrated that the guardrail worked, not that the plan was safe to apply. The active script also needed its v1 Authorization: Token header changed to v2 Bearer before that test; the two changes addressed distinct failures.
Terraform itself still refreshed full VM records. A later fresh plan, even with a longer request timeout and serial execution, failed on existing NetBox VM reads. The saved plan artifact was marked incomplete and not applyable. I did not turn a passing preflight into permission to apply an unsuccessful Terraform plan.
The operating distinction is between three kinds of evidence: a status endpoint proves a small authenticated request works; a field-limited query proves a narrowly scoped lookup works; and a Terraform plan requires all of its managed-resource refreshes to succeed. In this case the token problem was fixed, the preflight was made narrower, and the full-response latency remained an open NetBox investigation. Keeping those outcomes separate prevented a fast HTTP 200 from being mistaken for a recovered provisioning workflow.
References
- NetBox REST API: authentication and field selection — v2 Bearer tokens and
fields/omitquery parameters. - NetBox Terraform provider v5.3.0 release notes — introduction of v2-token support.
- Terraform
plancommand — default refresh behavior and-parallelism. - Terraform vSphere VM Preflight Guardrails — related collision-check workflow.
The request timings, failures, and preflight results above are from the incident’s operator output and session record; the public documentation explains the mechanisms, not those site-specific measurements.