一
b
. 地形配置的相关部分_名称.tf会像这样:
setting {
namespace = "aws:ec2:vpc"
name = "Subnets"
value = "${lookup(var.vpc_subnets, format("%s_%s", var.location, var.availability_zone))}, ${lookup(var.vpc_subnets, format("%s_%s", var.location, var.secondary_availability_zone))}"
}
variable "vpc_subnets" {
type = "map"
default = {
"frankfurt_a" = "subnet-12345671"
"frankfurt_b" = "subnet-12345672"
"frankfurt_c" = "subnet-12345673"
"ireland_a" = "subnet-12345674"
"ireland_b" = "subnet-12345675"
"ireland_c" = "subnet-12345676"
}
}
variable "availability_zone" {
default = "a"
}
variable "secondary_availability_zone" {
default = "b"
}
variable "regions" {
type = "map"
default = {
"frankfurt" = "eu-central-1"
"ireland" = "eu-west-1"
"london" = "eu-west-2"
}
}
variable "location" {
default = "ireland"
}