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
+15
View File
@@ -119,3 +119,18 @@ variable "switch_port_configs" {
description = "Puertos de switch a configurar. access_policy_number referencia el número de la política creada en switch_access_policies."
}
# Configuración de puertos por nombre de stack (resolución dinámica de seriales)
variable "switch_stack_port_configs" {
type = list(object({
stack_name = string # nombre exacto del stack en Meraki Dashboard
port_range = string # puerto único "1" o rango "1-48"
name = optional(string, "")
type = optional(string, "access")
vlan = optional(number, null)
access_policy_type = optional(string, "Open")
access_policy_number = optional(number, null)
}))
default = []
description = "Puertos de stack a configurar por nombre. Terraform resuelve los seriales de todos los miembros automáticamente."
}