aws terraform 子网关联

aws terraform 子网关联

我正在通过 terraform 创建一个 VPC - 但是我遇到了一些子网关联问题 - 这意味着 - 我有一个跨 3 AZ、abc 的私有子网。

它为我创建了 3 个子网,但是只有当我检查路由表时,它才与自身明确关联,并且仅与跨 AZ 的 3 个子网关联?

有任何想法吗 ?

子网:

 variable "private_subnets" {
  description = "A list of private subnets inside the VPC."
  default     = ["10.31.100.0/22","10.31.104.0/22","10.31.108.0/22"]
}

#AWS routeing association:     
resource "aws_route_table_association" "private" {
  count          = "${length(var.private_subnets)}"
  subnet_id      = "${element(aws_subnet.private.*.id, count.index)}"
  route_table_id = "${element(aws_route_table.private.*.id, count.index)}"

 resource "aws_subnet" "private" {
  vpc_id            = "${aws_vpc.mod.id}"
  cidr_block        = "${var.private_subnets[count.index]}"
  availability_zone = "${var.azs[count.index]}"
  count             = "${length(var.private_subnets)}"

  tags {
    Name = "${var.name}-subnet-private-${element(var.azs, count.index)}"
  }
}

resource "aws_route_table" "private" {
 vpc_id           = "${aws_vpc.mod.id}"
 propagating_vgws = ["${var.private_propagating_vgws}"]
 count            = "${length(var.private_subnets)}"

  tags {
    Name = "${var.name}-rt-private-${element(var.azs, count.index)}"
  }
}

Outputs: 

   output "private_subnets" {
  value = ["${aws_subnet.private.*.id}"]
}

  variable "azs" {
  description = "A list of Availability zones in the region"
  default     = ["eu-west-1a","eu-west-1b","eu-west-1c"]
}

相关内容