Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
platform/aws: Use autogenerated target group names
Browse files Browse the repository at this point in the history
ELB target group names are limited to 32 characters. Since we easily
hit this limit when trying to include the cluster and pool name in
the target group name, we move this information to AWS tags and let
Terraform generate a target group name automatically.
  • Loading branch information
johananl committed Apr 28, 2020
1 parent af09520 commit 28d4d62
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ resource "aws_lb_listener" "apiserver-https" {

# Target group of controllers
resource "aws_lb_target_group" "controllers" {
name = "${var.cluster_name}-controllers"
vpc_id = aws_vpc.network.id
target_type = "instance"

Expand All @@ -57,6 +56,10 @@ resource "aws_lb_target_group" "controllers" {
# Interval between health checks required to be 10 or 30
interval = 10
}

tags = {
ClusterName = var.cluster_name
}
}

# Attach controller instances to apiserver NLB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ resource "aws_lb_listener" "ingress-https" {
}

resource "aws_lb_target_group" "workers-http" {
name = "${var.cluster_name}-${var.pool_name}-http"
vpc_id = var.vpc_id
target_type = "instance"

Expand All @@ -41,10 +40,14 @@ resource "aws_lb_target_group" "workers-http" {
# Interval between health checks required to be 10 or 30
interval = 10
}

tags = {
ClusterName = var.cluster_name
PoolName = var.pool_name
}
}

resource "aws_lb_target_group" "workers-https" {
name = "${var.cluster_name}-${var.pool_name}-https"
vpc_id = var.vpc_id
target_type = "instance"

Expand All @@ -64,4 +67,9 @@ resource "aws_lb_target_group" "workers-https" {
# Interval between health checks required to be 10 or 30
interval = 10
}

tags = {
ClusterName = var.cluster_name
PoolName = var.pool_name
}
}
8 changes: 4 additions & 4 deletions pkg/assets/generated_assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 28d4d62

Please sign in to comment.