-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
NetBox version
v3.4.8
Python version
3.8
Steps to Reproduce
Ref: e-breuninger/terraform-provider-netbox#385
Using a tool which will produce parallel API calls to NetBox (e.g. Terraform), create two or more top-level Region objects with children, via the /dcim/regions endpoint.
In Terraform, this might look like this:
resource "netbox_region" "uk" {
name = "United Kingdom"
}
resource "netbox_region" "ireland" {
name = "Ireland"
}
resource "netbox_region" "london" {
name = "London"
parent_region_id = netbox_region.uk.id
}
resource "netbox_region" "gatwick" {
name = "Gatwick"
parent_region_id = netbox_region.uk.id
}
resource "netbox_region" "northeurope" {
name = "Azure North Europe"
parent_region_id = netbox_region.ireland.id
}
resource "netbox_region" "uksouth" {
name = "Azure UK South"
parent_region_id = netbox_region.london.id
}
Expected Behavior
The Regions are created with the correct tree structure in the NetBox UI
Observed Behavior
The top-level regions can sometimes be created with the same tree_id in the dcim_region table. This causes some weird UI issues whereby all the child regions will appear under one of the top-level regions, despite it not being their parent:
If you follow the child region links, the Parent IDs are set correctly.
To work around this, we can ensure that the top-level regions are created in serial so that they never receive the same tree_id value.

