Skip to content

Commit

Permalink
updates for bood_order and system_qos ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttyso committed Sep 28, 2024
1 parent 43b6ab5 commit 2829ad3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ A Terraform module to configure Intersight Infrastructure Policies.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >=1.3.0 |
| <a name="requirement_intersight"></a> [intersight](#requirement\_intersight) | >=1.0.47 |
| <a name="requirement_intersight"></a> [intersight](#requirement\_intersight) | >=1.0.55 |
## Providers

| Name | Version |
Expand Down
4 changes: 2 additions & 2 deletions boot_order.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ resource "intersight_boot_precision_policy" "map" {
name = each.value.name
organization { moid = var.orgs[each.value.org] }
dynamic "boot_devices" {
for_each = { for v in each.value.boot_devices : v.name => v }
for_each = { for k, v in each.value.boot_devices : k => v }
content {
additional_properties = boot_devices.value.additional_properties
enabled = boot_devices.value.enabled
object_type = boot_devices.value.object_type
name = boot_devices.value.name
object_type = boot_devices.value.object_type
}
}
dynamic "tags" {
Expand Down
6 changes: 3 additions & 3 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1596,10 +1596,10 @@ locals {
system_qos_loop_1 = { for i in flatten([for org in local.org_keys : [
for v in lookup(local.model[org], "system_qos", []) : merge(local.qos, v, {
classes = length(regexall(true, lookup(v, "configure_default_classes", local.qos.configure_default_classes))
) > 0 ? { for v in local.qos.classes_default : v.priority => v } : length(
) > 0 ? { for k, v in local.qos.classes_default : k => v } : length(
regexall(true, lookup(v, "configure_recommended_classes", local.qos.configure_recommended_classes))
) > 0 ? { for v in local.qos.classes_recommended : v.priority => v } : length(lookup(v, "classes", [])
) == 0 ? local.qos.classes : { for v in v.classes : v.priority => v }
) > 0 ? { for k, v in local.qos.classes_recommended : k => v } : length(lookup(v, "classes", [])
) == 0 ? local.qos.classes : { for k, v in v.classes : k => v }
name = "${local.npfx[org].system_qos}${v.name}${local.nsfx[org].system_qos}"
org = org
tags = lookup(v, "tags", var.global_settings.tags)
Expand Down
8 changes: 5 additions & 3 deletions port.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "intersight_fabric_appliance_pc_role" "map" {
depends_on = [intersight_fabric_port_policy.map]
for_each = local.port_channel_appliances
admin_speed = each.value.admin_speed
# aggregate_port_id = lookup(each.value, "breakout_port_id", 0)
# fec = each.value.fec
mode = each.value.mode
pc_id = each.value.pc_id
priority = each.value.priority
Expand Down Expand Up @@ -85,7 +85,8 @@ resource "intersight_fabric_uplink_pc_role" "map" {
depends_on = [intersight_fabric_port_policy.map]
for_each = local.port_channel_ethernet_uplinks
admin_speed = each.value.admin_speed
pc_id = each.value.pc_id
# fec = each.value.fec
pc_id = each.value.pc_id
port_policy { moid = intersight_fabric_port_policy.map[each.value.port_policy].moid }
dynamic "eth_network_group_policy" {
for_each = { for v in [each.value.ethernet_network_group_policy] : v => v if element(split("/", v), 1) != "UNUSED" }
Expand Down Expand Up @@ -178,7 +179,8 @@ resource "intersight_fabric_fcoe_uplink_pc_role" "map" {
depends_on = [intersight_fabric_port_policy.map]
for_each = local.port_channel_fcoe_uplinks
admin_speed = each.value.admin_speed
pc_id = each.value.pc_id
# fec = each.value.fec
pc_id = each.value.pc_id
port_policy { moid = intersight_fabric_port_policy.map[each.value.port_policy].moid }
dynamic "link_aggregation_policy" {
for_each = { for v in [each.value.link_aggregation_policy] : v => v if element(split("/", v), 1) != "UNUSED" }
Expand Down
2 changes: 1 addition & 1 deletion provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ terraform {
required_providers {
intersight = {
source = "CiscoDevNet/intersight"
version = ">=1.0.47"
version = ">=1.0.55"
}
}
required_version = ">=1.3.0"
Expand Down
28 changes: 14 additions & 14 deletions system_qos.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ resource "intersight_fabric_system_qos_policy" "map" {
name = each.value.name
organization { moid = var.orgs[each.value.org] }
dynamic "classes" {
for_each = each.value.classes
for_each = { for k, v in each.value.classes : k => v }
content {
additional_properties = ""
admin_state = length(regexall("(Best Effort|FC)", classes.key)
) > 0 ? "Enabled" : lookup(classes.value, "state", local.qos.classes[classes.key].state)
bandwidth_percent = length(regexall("Enabled", lookup(classes.value, "state", local.qos.classes[classes.key].weight))
) > 0 ? tonumber(format("%.0f", tonumber((tonumber(lookup(classes.value, "weight", local.qos.classes[classes.key].weight)) / each.value.bandwidth_total) * 100))) : 0
cos = lookup(classes.value, "cos", local.qos.classes[classes.key].cos)
mtu = classes.key == "FC" ? 2240 : length(
regexall("Enabled", lookup(classes.value, "state", local.qos.classes[classes.key].state))
admin_state = length(regexall("(Best Effort|FC)", classes.value.priority)
) > 0 ? "Enabled" : lookup(classes.value, "state", local.qos.classes[classes.value.priority].state)
bandwidth_percent = length(regexall("Enabled", lookup(classes.value, "state", local.qos.classes[classes.value.priority].weight))
) > 0 ? tonumber(format("%.0f", tonumber((tonumber(lookup(classes.value, "weight", local.qos.classes[classes.value.priority].weight)) / each.value.bandwidth_total) * 100))) : 0
cos = lookup(classes.value, "cos", local.qos.classes[classes.value.priority].cos)
mtu = classes.value.priority == "FC" ? 2240 : length(
regexall("Enabled", lookup(classes.value, "state", local.qos.classes[classes.value.priority].state))
) > 0 && each.value.jumbo_mtu == true ? 9216 : 1500
multicast_optimize = classes.key == "Silver" ? true : false
name = classes.key
multicast_optimize = classes.value.priority == "Silver" ? true : false
name = classes.value.priority
object_type = "fabric.QosClass"
packet_drop = length(
regexall("(Best Effort)", classes.key)) > 0 ? true : length(
regexall("(FC)", classes.key)
) > 0 ? false : lookup(classes.value, "packet_drop", local.qos.classes[classes.key].packet_drop)
weight = lookup(classes.value, "weight", local.qos.classes[classes.key].weight)
regexall("(Best Effort)", classes.value.priority)) > 0 ? true : length(
regexall("(FC)", classes.value.priority)
) > 0 ? false : lookup(classes.value, "packet_drop", local.qos.classes[classes.value.priority].packet_drop)
weight = lookup(classes.value, "weight", local.qos.classes[classes.value.priority].weight)
}
}
dynamic "tags" {
Expand Down

0 comments on commit 2829ad3

Please sign in to comment.