module "vpc" { source = "alibaba/vpc/alicloud" version = "1.10.0" vpc_name = var.vpc-name vpc_cidr = var.vpc-cidr availability_zones = data.alicloud_zones.zones.ids vswitch_cidrs = cidrsubnets(var.vpc-cidr, 2, 2) vswitch_name = var.vswitch-prefix vpc_tags = local.tags vswitch_tags = local.tags } data "alicloud_zones" "zones" { available_disk_category = "cloud_ssd" available_resource_creation = "VSwitch" } # resource "alicloud_vpc" "vpc" { # vpc_name = var.vpc-name # description = var.vpc-description # cidr_block = var.vpc-cidr # is_default = true # enable_ipv6 = false # tags = local.tags # } # # # locals { # vswitch-cidrs = cidrsubnets(var.vpc-cidr, 2, 2) # vswitch-map = { # for k, v in zipmap(local.vswitch-cidrs, data.alicloud_zones.zones.ids) : v => k # } # } # # resource "alicloud_vswitch" "vswitches" { # for_each = local.vswitch-map # vswitch_name = "Vswitch-${each.key}" # cidr_block = each.value # vpc_id = alicloud_vpc.vpc.id # zone_id = each.key # }