Skip to content

Commit

Permalink
link agg device mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Parafiniuk committed Dec 10, 2024
1 parent 078228a commit a1579b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions meraki_switches.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down

0 comments on commit a1579b8

Please sign in to comment.