Add tag to AWS VPC subnets for automatic subnet discovery by load balancers or ingress controllers (#8705)

This commit is contained in:
SOPHAL HONG 2022-04-13 02:05:23 +09:00 committed by GitHub
parent 30306d6ec7
commit 3d4baea01c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,8 @@ resource "aws_subnet" "cluster-vpc-subnets-public" {
tags = merge(var.default_tags, tomap({ tags = merge(var.default_tags, tomap({
Name = "kubernetes-${var.aws_cluster_name}-${element(var.aws_avail_zones, count.index)}-public" Name = "kubernetes-${var.aws_cluster_name}-${element(var.aws_avail_zones, count.index)}-public"
"kubernetes.io/cluster/${var.aws_cluster_name}" = "member" "kubernetes.io/cluster/${var.aws_cluster_name}" = "shared"
"kubernetes.io/role/elb" = "1"
})) }))
} }
@ -49,6 +50,8 @@ resource "aws_subnet" "cluster-vpc-subnets-private" {
tags = merge(var.default_tags, tomap({ tags = merge(var.default_tags, tomap({
Name = "kubernetes-${var.aws_cluster_name}-${element(var.aws_avail_zones, count.index)}-private" Name = "kubernetes-${var.aws_cluster_name}-${element(var.aws_avail_zones, count.index)}-private"
"kubernetes.io/cluster/${var.aws_cluster_name}" = "shared"
"kubernetes.io/role/internal-elb" = "1"
})) }))
} }