Skip to content

Commit

Permalink
qos rules order
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Parafiniuk committed Dec 10, 2024
1 parent a1579b8 commit e2e54a4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions meraki_switches.tf
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ locals {
for network in try(organization.networks, []) : [
for switch_qos_rule in try(network.switch_qos_rules, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id

key = "${organization.name}/${network.name}/qos_rules/${switch_qos_rule.qos_rule_name}"
data = try(switch_qos_rule, null)
} if try(network.switch_qos_rules, null) != null
] if try(organization.networks, null) != null
Expand All @@ -295,7 +295,7 @@ locals {
}

resource "meraki_switch_qos_rule" "net_switch_qos_rule" {
for_each = { for i, v in local.networks_switch_qos_rules : i => v }
for_each = { for i, v in local.networks_switch_qos_rules : v.key => v }
network_id = each.value.network_id

vlan = try(each.value.data.vlan, local.defaults.meraki.networks.networks_switch_qos_rules.vlan, null)
Expand All @@ -310,6 +310,25 @@ resource "meraki_switch_qos_rule" "net_switch_qos_rule" {

}

locals {
networks_switch_qos_rules_orders = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id
rule_ids = [for r in network.switch_qos_rules : meraki_switch_qos_rule.net_switch_qos_rule["${organization.name}/${network.name}/qos_rules/${r.qos_rule_name}"].id]
} if try(network.switch_qos_rules, null) != null
] if try(domain.organizations, null) != null
] if try(local.meraki.domains, null) != null
])
}

resource "meraki_switch_qos_rule_order" "net_switch_qos_rule_order" {
for_each = { for i, v in local.networks_switch_qos_rules_orders : i => v }
network_id = each.value.network_id
rule_ids = each.value.rule_ids
}

locals {
networks_switch_routing_multicast = flatten([
Expand Down

0 comments on commit e2e54a4

Please sign in to comment.