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 2b800e7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ module "meraki" {
| [meraki_switch_port.devices_switch_port](https://registry.terraform.io/providers/CiscoDevNet/meraki/0.1.3/docs/resources/switch_port) | resource |
| [meraki_switch_port_schedule.net_switch_port_schedules](https://registry.terraform.io/providers/CiscoDevNet/meraki/0.1.3/docs/resources/switch_port_schedule) | resource |
| [meraki_switch_qos_rule.net_switch_qos_rule](https://registry.terraform.io/providers/CiscoDevNet/meraki/0.1.3/docs/resources/switch_qos_rule) | resource |
| [meraki_switch_qos_rule_order.net_switch_qos_rule_order](https://registry.terraform.io/providers/CiscoDevNet/meraki/0.1.3/docs/resources/switch_qos_rule_order) | resource |
| [meraki_switch_routing_interface.devices_switch_routing_interface](https://registry.terraform.io/providers/CiscoDevNet/meraki/0.1.3/docs/resources/switch_routing_interface) | resource |
| [meraki_switch_routing_interface_dhcp.devices_switch_routing_interfaces_dhcp](https://registry.terraform.io/providers/CiscoDevNet/meraki/0.1.3/docs/resources/switch_routing_interface_dhcp) | resource |
| [meraki_switch_routing_multicast.net_switch_routing_multicast](https://registry.terraform.io/providers/CiscoDevNet/meraki/0.1.3/docs/resources/switch_routing_multicast) | resource |
Expand Down
25 changes: 22 additions & 3 deletions meraki_switches.tf
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ 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

data = try(switch_qos_rule, null)
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
] if try(domain.organizations, 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 2b800e7

Please sign in to comment.