From a1579b830933bc130a224d13f7bf3b808b33601a Mon Sep 17 00:00:00 2001 From: Marcin Parafiniuk Date: Tue, 10 Dec 2024 11:04:27 +0100 Subject: [PATCH 1/2] link agg device mapping --- meraki_switches.tf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meraki_switches.tf b/meraki_switches.tf index 0d99be5..393ce4c 100644 --- a/meraki_switches.tf +++ b/meraki_switches.tf @@ -175,7 +175,10 @@ locals { for network in try(organization.networks, []) : [ for switch_link_aggregation in try(network.switch_link_aggregations, []) : { network_id = meraki_network.network["${organization.name}/${network.name}"].id - + switch_ports = [for p in switch_link_aggregation.switch_ports : { + serial = meraki_device.device["${organization.name}/${network.name}/devices/${p.device}"].serial + port_id = p.port_id + }] data = try(switch_link_aggregation, null) } if try(network.switch_link_aggregations, null) != null ] if try(organization.networks, null) != null @@ -189,7 +192,7 @@ resource "meraki_switch_link_aggregation" "net_switch_link_aggregation" { for_each = { for i, v in local.networks_switch_link_aggregations : i => v } network_id = each.value.network_id - switch_ports = try(each.value.data.switch_ports, local.defaults.meraki.networks.networks_switch_link_aggregations.switch_ports, null) + switch_ports = each.value.switch_ports switch_profile_ports = try(each.value.data.switch_profile_ports, local.defaults.meraki.networks.networks_switch_link_aggregations.switch_profile_ports, null) depends_on = [meraki_network_device_claim.net_device_claim] From fa5c5b5e187b905cf74c6d2236a61b5113a8b194 Mon Sep 17 00:00:00 2001 From: Marcin Parafiniuk Date: Tue, 10 Dec 2024 16:03:44 +0100 Subject: [PATCH 2/2] depends logic fix --- meraki_switches.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meraki_switches.tf b/meraki_switches.tf index 393ce4c..e43680a 100644 --- a/meraki_switches.tf +++ b/meraki_switches.tf @@ -195,7 +195,7 @@ resource "meraki_switch_link_aggregation" "net_switch_link_aggregation" { switch_ports = each.value.switch_ports switch_profile_ports = try(each.value.data.switch_profile_ports, local.defaults.meraki.networks.networks_switch_link_aggregations.switch_profile_ports, null) - depends_on = [meraki_network_device_claim.net_device_claim] + depends_on = [meraki_switch_stack.net_switch_stacks] }