a3984bf0cd
A per-site data-source lookup cannot resolve a global object before the global unit has applied it, which deadlocks the first plan. Pass device-type, device role and dhcp IPAM role ids as dependency outputs instead, mocked for plan.
16 lines
714 B
Terraform
16 lines
714 B
Terraform
# Network equipment is declared here, unlike host devices: nothing probes a
|
|
# switch, and its ports must already exist in NetBox for discovery to cable a
|
|
# host interface to one. The device type and role are global objects, created
|
|
# by the netbox-global unit.
|
|
resource "netbox_device" "network" {
|
|
for_each = var.network_devices
|
|
|
|
name = each.key
|
|
device_type_id = var.device_type_ids[each.value.device_type]
|
|
role_id = var.device_role_ids[each.value.role]
|
|
site_id = tonumber(netbox_site.this.id)
|
|
serial = each.value.serial
|
|
asset_tag = each.value.asset_tag
|
|
custom_fields = each.value.chassis_mac != null ? { chassis_mac = lower(each.value.chassis_mac) } : null
|
|
}
|