From a1068c831d49d0d70f8a17cbe9b35677ffd05760 Mon Sep 17 00:00:00 2001 From: Jose Martinez Date: Thu, 26 Mar 2026 07:07:38 +0100 Subject: [PATCH 1/2] feat(BCN01-LAB): puerto 2 eqt-lab-st01-sw01 como AP trunk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Añadido puerto 2 de eqt-lab-st01-sw01 como trunk AP con VLAN nativa 108 (APs) y tageadas 100 (ACCESS) y 101 (GUEST), igual que puerto 3 Co-Authored-By: Claude Sonnet 4.6 --- sites/BCN01-LAB/switch.auto.tfvars | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sites/BCN01-LAB/switch.auto.tfvars b/sites/BCN01-LAB/switch.auto.tfvars index 6d73fc5..0641337 100644 --- a/sites/BCN01-LAB/switch.auto.tfvars +++ b/sites/BCN01-LAB/switch.auto.tfvars @@ -144,6 +144,16 @@ switch_named_port_configs = [ vlan = 110 # SERVERS access_policy_type = "Open" }, + { + # Puerto 2 de eqt-lab-st01-sw01 → AP (trunk, nativa 108 APs, tageadas 100 ACCESS y 101 GUEST) + switch_name = "eqt-lab-st01-sw01" + port_range = "2" + name = "AP" + type = "trunk" + vlan = 108 # APs - VLAN nativa (untagged) + allowed_vlans = "100,101,108" # ACCESS + GUEST + APs + access_policy_type = "Open" + }, { # Puerto 3 de eqt-lab-st01-sw01 → AP (trunk, nativa 108 APs, tageadas 100 ACCESS y 101 GUEST) switch_name = "eqt-lab-st01-sw01" From 6dc629ea18c6395212dc578fb1981fb42208505f Mon Sep 17 00:00:00 2001 From: Jose Martinez Date: Thu, 26 Mar 2026 07:09:12 +0100 Subject: [PATCH 2/2] feat: soporte port_range con listas y combinaciones ("2,3", "1-3,5") MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _expand_range ahora procesa segmentos separados por coma, cada uno puede ser un puerto único o un rango numérico (1-48). Ejemplos: "2,3" -> ["2","3"] | "1-3,5,47" -> ["1","2","3","5","47"] - switch.auto.tfvars: puertos 2 y 3 de eqt-lab-st01-sw01 consolidados en una sola entrada con port_range = "2,3" Co-Authored-By: Claude Sonnet 4.6 --- modules/meraki-site/main.tf | 15 ++++++++------- sites/BCN01-LAB/switch.auto.tfvars | 16 +++------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/modules/meraki-site/main.tf b/modules/meraki-site/main.tf index a51244a..1195b1f 100755 --- a/modules/meraki-site/main.tf +++ b/modules/meraki-site/main.tf @@ -31,17 +31,18 @@ locals { network_id = [for n in data.meraki_networks.net.items : n.id if n.name == var.network_name][0] # Helper: expande un port_range en lista de port_ids - # "1-48" -> ["1","2",...,"48"] | "1" -> ["1"] + # Soporta: "1" -> ["1"] | "1-4" -> ["1","2","3","4"] | "2,3" -> ["2","3"] | "1-3,5,47" -> ["1","2","3","5","47"] _expand_range = { for config in concat(var.switch_port_configs, var.switch_stack_port_configs, var.switch_named_port_configs) : - "${try(config.serial, try(config.stack_name, config.switch_name))}:${config.port_range}" => ( - length(split("-", config.port_range)) == 2 + "${try(config.serial, try(config.stack_name, config.switch_name))}:${config.port_range}" => flatten([ + for segment in split(",", config.port_range) : + length(split("-", trimspace(segment))) == 2 ? [for i in range( - tonumber(split("-", config.port_range)[0]), - tonumber(split("-", config.port_range)[1]) + 1 + tonumber(split("-", trimspace(segment))[0]), + tonumber(split("-", trimspace(segment))[1]) + 1 ) : tostring(i)] - : [config.port_range] - ) + : [trimspace(segment)] + ]) } # Mapa de nombre de stack -> lista de seriales de sus miembros diff --git a/sites/BCN01-LAB/switch.auto.tfvars b/sites/BCN01-LAB/switch.auto.tfvars index 0641337..694f391 100644 --- a/sites/BCN01-LAB/switch.auto.tfvars +++ b/sites/BCN01-LAB/switch.auto.tfvars @@ -145,22 +145,12 @@ switch_named_port_configs = [ access_policy_type = "Open" }, { - # Puerto 2 de eqt-lab-st01-sw01 → AP (trunk, nativa 108 APs, tageadas 100 ACCESS y 101 GUEST) + # Puertos 2 y 3 de eqt-lab-st01-sw01 → APs (trunk, nativa 108 APs, tageadas 100 ACCESS y 101 GUEST) switch_name = "eqt-lab-st01-sw01" - port_range = "2" + port_range = "2,3" name = "AP" type = "trunk" - vlan = 108 # APs - VLAN nativa (untagged) - allowed_vlans = "100,101,108" # ACCESS + GUEST + APs - access_policy_type = "Open" - }, - { - # Puerto 3 de eqt-lab-st01-sw01 → AP (trunk, nativa 108 APs, tageadas 100 ACCESS y 101 GUEST) - switch_name = "eqt-lab-st01-sw01" - port_range = "3" - name = "AP" - type = "trunk" - vlan = 108 # APs - VLAN nativa (untagged) + vlan = 108 # APs - VLAN nativa (untagged) allowed_vlans = "100,101,108" # ACCESS + GUEST + APs access_policy_type = "Open" },