feat: add switch stack port config with dynamic serial resolution

- Add data source meraki_switch_stacks to resolve member serials by stack name
- Add switch_stack_port_configs variable: specify stack_name + port_range
  instead of individual switch serials
- Terraform applies port_range to ALL members of the stack automatically
- Merge switch_port_configs and switch_stack_port_configs into all_ports local
- Add example for bcn01-lab-stack01 (2x48p) in switch.auto.tfvars

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jose Martinez
2026-03-25 08:42:48 +01:00
co-authored by Claude Sonnet 4.6
parent 16c09f8cc5
commit c6343d977e
5 changed files with 126 additions and 13 deletions
+39
View File
@@ -73,3 +73,42 @@ switch_access_policies = [
#
# ]
switch_port_configs = []
# --- PUERTOS DE STACK ---
# Terraform resuelve automáticamente los seriales de todos los miembros del stack.
# El stack_name debe coincidir exactamente con el nombre en Dashboard > Switches > Stacks.
# Terraform aplicará el mismo port_range a CADA switch del stack (ambos de 48 puertos).
#
# Ejemplo para bcn01-lab-stack01 (2x 48 puertos):
# switch_stack_port_configs = [
#
# # Puertos 1-44: acceso general con 802.1X (PCs, portátiles)
# {
# stack_name = "bcn01-lab-stack01"
# port_range = "1-44"
# type = "access"
# vlan = 100 # ACCESS - fallback si Okta no devuelve VLAN
# access_policy_type = "Custom access policy"
# access_policy_number = 1 # id de la política DOT1X-CORPO
# },
#
# # Puertos 45-46: impresoras (VLAN fija, sin 802.1X)
# {
# stack_name = "bcn01-lab-stack01"
# port_range = "45-46"
# type = "access"
# vlan = 103 # PRINTERS
# access_policy_type = "Open"
# },
#
# # Puertos 47-48: APs (VLAN fija, sin 802.1X)
# {
# stack_name = "bcn01-lab-stack01"
# port_range = "47-48"
# type = "access"
# vlan = 108 # APs
# access_policy_type = "Open"
# },
#
# ]
switch_stack_port_configs = []