|
1 | 1 | locals { |
2 | 2 | device_ip_to_id = try({ |
3 | | - for device in data.catalystcenter_network_devices.all_devices.devices : |
4 | | - device.management_ip_address => device.id |
| 3 | + for device in data.catalystcenter_network_devices.all_devices.devices : device.management_ip_address => device.id |
| 4 | + }, {}) |
| 5 | + |
| 6 | + device_name_to_id = try({ |
| 7 | + for device in data.catalystcenter_network_devices.all_devices.devices : device.hostname => device.id |
5 | 8 | }, {}) |
6 | 9 |
|
7 | 10 | border_devices = { for device in try(local.catalyst_center.fabric.border_devices, []) : device.name => device } |
@@ -84,7 +87,7 @@ resource "catalystcenter_device_role" "role" { |
84 | 87 | } |
85 | 88 |
|
86 | 89 | resource "catalystcenter_fabric_provision_device" "non_fabric_device" { |
87 | | - for_each = { for device in try(local.catalyst_center.inventory.devices, []) : device.name => device if strcontains(device.state, "PROVISION") && try(device.fabric_roles, null) == null } |
| 90 | + for_each = { for device in try(local.catalyst_center.inventory.devices, []) : device.name => device if strcontains(device.state, "PROVISION") && try(device.fabric_roles, null) == null && try(device.managed_ap_locations, null) == null } |
88 | 91 |
|
89 | 92 | site_id = try(local.site_id_list[each.value.site], null) |
90 | 93 | network_device_id = try(local.device_ip_to_id[each.value.device_ip], "") |
@@ -151,7 +154,7 @@ resource "catalystcenter_fabric_l2_handoff" "l2_handoff" { |
151 | 154 | } |
152 | 155 |
|
153 | 156 | resource "catalystcenter_wireless_device_provision" "wireless_controller" { |
154 | | - for_each = { for device in try(local.catalyst_center.inventory.devices, []) : device.name => device if strcontains(device.state, "PROVISION") && contains(try(device.fabric_roles, []), "WIRELESS_CONTROLLER_NODE") } |
| 157 | + for_each = { for device in try(local.catalyst_center.inventory.devices, []) : device.name => device if strcontains(device.state, "PROVISION") && (contains(try(device.fabric_roles, []), "WIRELESS_CONTROLLER_NODE") || try(device.managed_ap_locations, null) != null) } |
155 | 158 |
|
156 | 159 | device_name = each.key |
157 | 160 | site = try(each.value.site, null) |
|
0 commit comments