Skip to content

Commit

Permalink
wireless ssid number
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Parafiniuk committed Dec 11, 2024
1 parent c4005f8 commit b3b2e9a
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions meraki_wireless.tf
Original file line number Diff line number Diff line change
Expand Up @@ -143,29 +143,15 @@ resource "meraki_wireless_settings" "net_wireless_settings" {
}
# Apply the Wireless SSIDs
locals {
wireless_ssids_numbers_list = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : [
for i, wireless_ssid in try(network.wireless_ssids, []) : {
key = format("${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}")
number = i
} if try(network.wireless_ssids, null) != null
] if try(organization.networks, null) != null
] if try(domain.organizations, null) != null
] if try(local.meraki.domains, null) != null
])
wireless_ssids_map = { for w in local.wireless_ssids_numbers_list : w.key => w.number }
networks_wireless_ssids = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : [
for i, wireless_ssid in try(network.wireless_ssids, []) : {
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = i
data = try(wireless_ssid, null)
key = "${organization.name}/${network.name}/ssids/${wireless_ssid.name}"
} if try(network.wireless_ssids, null) != null
] if try(organization.networks, null) != null
] if try(domain.organizations, null) != null
Expand All @@ -174,9 +160,9 @@ locals {
}

resource "meraki_wireless_ssid" "net_wireless_ssids" {
for_each = { for i, v in local.networks_wireless_ssids : i => v }
for_each = { for v in local.networks_wireless_ssids : v.key => v }
network_id = each.value.network_id
number = each.value.number
number = each.value.data.number

name = try(each.value.data.name, local.defaults.meraki.networks.networks_wireless_ssids.name, null)
enabled = try(each.value.data.enabled, local.defaults.meraki.networks.networks_wireless_ssids.enabled, null)
Expand Down Expand Up @@ -266,7 +252,7 @@ locals {
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
eap_override = try(wireless_ssid.eap_override, null)
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
} if try(wireless_ssid.eap_override, null) != null
] if try(organization.networks, null) != null
] if try(domain.organizations, null) != null
Expand Down Expand Up @@ -296,7 +282,7 @@ locals {
for network in try(organization.networks, []) : [
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
data = try(wireless_ssid.device_type_group_policies, null)
} if try(wireless_ssid.device_type_group_policies, null) != null
] if try(organization.networks, null) != null
Expand Down Expand Up @@ -327,7 +313,7 @@ locals {
for network in try(organization.networks, []) : [
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
data = try(wireless_ssid.firewall_l3_firewall_rules, null)
} if try(wireless_ssid.firewall_l3_firewall_rules, null) != null
] if try(organization.networks, null) != null
Expand Down Expand Up @@ -357,7 +343,7 @@ locals {
for network in try(organization.networks, []) : [
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
data = try(wireless_ssid.hotspot20, null)
} if try(wireless_ssid.hotspot20, null) != null
] if try(organization.networks, null) != null
Expand Down Expand Up @@ -394,7 +380,7 @@ locals {
for wireless_ssid in try(network.wireless_ssids, []) : [
for identity_psk in try(wireless_ssid.identity_psks, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
data = try(identity_psk, null)
} if try(wireless_ssid.identity_psks, null) != null
] if try(network.wireless_ssids, null) != null
Expand Down Expand Up @@ -427,7 +413,7 @@ locals {
for network in try(organization.networks, []) : [
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
data = try(wireless_ssid.schedules, null)
} if try(wireless_ssid.schedules, null) != null
] if try(organization.networks, null) != null
Expand Down Expand Up @@ -457,7 +443,7 @@ locals {
for network in try(organization.networks, []) : [
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
data = try(wireless_ssid.splash_settings, null)
} if try(wireless_ssid.splash_settings, null) != null
] if try(organization.networks, null) != null
Expand Down Expand Up @@ -516,7 +502,7 @@ locals {
for network in try(organization.networks, []) : [
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
data = try(wireless_ssid.traffic_shaping_rules, null)
} if try(wireless_ssid.traffic_shaping_rules, null) != null
] if try(organization.networks, null) != null
Expand Down Expand Up @@ -547,7 +533,7 @@ locals {
for network in try(organization.networks, []) : [
for wireless_ssid in try(network.wireless_ssids, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
number = local.wireless_ssids_map["${organization.name}/${network.name}/wireless_ssid/${wireless_ssid.name}"]
number = meraki_wireless_ssid.net_wireless_ssids["${organization.name}/${network.name}/ssids/${wireless_ssid.name}"].number
data = try(wireless_ssid.bonjour_forwarding, null)
} if try(wireless_ssid.bonjour_forwarding, null) != null
] if try(organization.networks, null) != null
Expand Down

0 comments on commit b3b2e9a

Please sign in to comment.