From b02ca699c7c599b1f888eb0c0f38f72de2dd93eb Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Sat, 23 Mar 2024 19:38:08 +0100 Subject: [PATCH] Assign prefixes to VLANs --- modules/device/networks.tf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/device/networks.tf b/modules/device/networks.tf index d7fe2ef..db28d70 100644 --- a/modules/device/networks.tf +++ b/modules/device/networks.tf @@ -11,8 +11,9 @@ resource "netbox_prefix" "local_v4" { resource "netbox_prefix" "networks_v4" { for_each = netbox_vlan.networks - vrf_id = netbox_vrf.local.id - prefix = cidrsubnet(var.client_prefix_v4, 8, each.value.vid) + vrf_id = netbox_vrf.local.id + vlan_id = each.value.id + prefix = cidrsubnet(var.client_prefix_v4, 8, each.value.vid) status = "active" description = "'${each.value.name}' network for ${var.name}" @@ -21,8 +22,9 @@ resource "netbox_prefix" "networks_v4" { resource "netbox_prefix" "networks_v6" { for_each = netbox_vlan.networks - vrf_id = netbox_vrf.local.id - prefix = cidrsubnet(netbox_available_prefix.site_v6.prefix, 8, each.value.vid) + vrf_id = netbox_vrf.local.id + vlan_id = each.value.id + prefix = cidrsubnet(netbox_available_prefix.site_v6.prefix, 8, each.value.vid) status = "active" description = "'${each.value.name}' network for ${var.name}"