@@ -111,7 +111,6 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-existingsg-example-c
111111 id = aws_launch_template. master-us-test-1a-masters-existingsg-example-com . id
112112 version = aws_launch_template. master-us-test-1a-masters-existingsg-example-com . latest_version
113113 }
114- load_balancers = [aws_elb . api-existingsg-example-com . id ]
115114 max_instance_lifetime = 0
116115 max_size = 1
117116 metrics_granularity = " 1Minute"
@@ -168,6 +167,7 @@ resource "aws_autoscaling_group" "master-us-test-1a-masters-existingsg-example-c
168167 propagate_at_launch = true
169168 value = " owned"
170169 }
170+ target_group_arns = [aws_lb_target_group . tcp-existingsg-example-co-jml1o0 . id ]
171171 vpc_zone_identifier = [aws_subnet . us-test-1a-existingsg-example-com . id ]
172172}
173173
@@ -177,7 +177,6 @@ resource "aws_autoscaling_group" "master-us-test-1b-masters-existingsg-example-c
177177 id = aws_launch_template. master-us-test-1b-masters-existingsg-example-com . id
178178 version = aws_launch_template. master-us-test-1b-masters-existingsg-example-com . latest_version
179179 }
180- load_balancers = [aws_elb . api-existingsg-example-com . id ]
181180 max_instance_lifetime = 0
182181 max_size = 1
183182 metrics_granularity = " 1Minute"
@@ -234,6 +233,7 @@ resource "aws_autoscaling_group" "master-us-test-1b-masters-existingsg-example-c
234233 propagate_at_launch = true
235234 value = " owned"
236235 }
236+ target_group_arns = [aws_lb_target_group . tcp-existingsg-example-co-jml1o0 . id ]
237237 vpc_zone_identifier = [aws_subnet . us-test-1b-existingsg-example-com . id ]
238238}
239239
@@ -243,7 +243,6 @@ resource "aws_autoscaling_group" "master-us-test-1c-masters-existingsg-example-c
243243 id = aws_launch_template. master-us-test-1c-masters-existingsg-example-com . id
244244 version = aws_launch_template. master-us-test-1c-masters-existingsg-example-com . latest_version
245245 }
246- load_balancers = [aws_elb . api-existingsg-example-com . id ]
247246 max_instance_lifetime = 0
248247 max_size = 1
249248 metrics_granularity = " 1Minute"
@@ -300,6 +299,7 @@ resource "aws_autoscaling_group" "master-us-test-1c-masters-existingsg-example-c
300299 propagate_at_launch = true
301300 value = " owned"
302301 }
302+ target_group_arns = [aws_lb_target_group . tcp-existingsg-example-co-jml1o0 . id ]
303303 vpc_zone_identifier = [aws_subnet . us-test-1c-existingsg-example-com . id ]
304304}
305305
@@ -547,34 +547,6 @@ resource "aws_ebs_volume" "c-etcd-main-existingsg-example-com" {
547547 type = " gp3"
548548}
549549
550- resource "aws_elb" "api-existingsg-example-com" {
551- connection_draining = true
552- connection_draining_timeout = 300
553- cross_zone_load_balancing = false
554- health_check {
555- healthy_threshold = 2
556- interval = 10
557- target = " SSL:443"
558- timeout = 5
559- unhealthy_threshold = 2
560- }
561- idle_timeout = 300
562- listener {
563- instance_port = 443
564- instance_protocol = " TCP"
565- lb_port = 443
566- lb_protocol = " TCP"
567- }
568- name = " api-existingsg-example-co-ikb7m9"
569- security_groups = [" sg-elb" ]
570- subnets = [aws_subnet . us-test-1a-existingsg-example-com . id , aws_subnet . us-test-1b-existingsg-example-com . id , aws_subnet . us-test-1c-existingsg-example-com . id ]
571- tags = {
572- " KubernetesCluster" = " existingsg.example.com"
573- " Name" = " api.existingsg.example.com"
574- " kubernetes.io/cluster/existingsg.example.com" = " owned"
575- }
576- }
577-
578550resource "aws_iam_instance_profile" "masters-existingsg-example-com" {
579551 name = " masters.existingsg.example.com"
580552 role = aws_iam_role. masters-existingsg-example-com . name
@@ -1034,6 +1006,58 @@ resource "aws_launch_template" "nodes-existingsg-example-com" {
10341006 user_data = filebase64 (" ${ path . module } /data/aws_launch_template_nodes.existingsg.example.com_user_data" )
10351007}
10361008
1009+ resource "aws_lb" "api-existingsg-example-com" {
1010+ enable_cross_zone_load_balancing = false
1011+ internal = false
1012+ load_balancer_type = " network"
1013+ name = " api-existingsg-example-co-ikb7m9"
1014+ security_groups = [" sg-elb" ]
1015+ subnet_mapping {
1016+ subnet_id = aws_subnet. us-test-1a-existingsg-example-com . id
1017+ }
1018+ subnet_mapping {
1019+ subnet_id = aws_subnet. us-test-1b-existingsg-example-com . id
1020+ }
1021+ subnet_mapping {
1022+ subnet_id = aws_subnet. us-test-1c-existingsg-example-com . id
1023+ }
1024+ tags = {
1025+ " KubernetesCluster" = " existingsg.example.com"
1026+ " Name" = " api.existingsg.example.com"
1027+ " kubernetes.io/cluster/existingsg.example.com" = " owned"
1028+ }
1029+ }
1030+
1031+ resource "aws_lb_listener" "api-existingsg-example-com-443" {
1032+ default_action {
1033+ target_group_arn = aws_lb_target_group. tcp-existingsg-example-co-jml1o0 . id
1034+ type = " forward"
1035+ }
1036+ load_balancer_arn = aws_lb. api-existingsg-example-com . id
1037+ port = 443
1038+ protocol = " TCP"
1039+ }
1040+
1041+ resource "aws_lb_target_group" "tcp-existingsg-example-co-jml1o0" {
1042+ connection_termination = " true"
1043+ deregistration_delay = " 30"
1044+ health_check {
1045+ healthy_threshold = 2
1046+ interval = 10
1047+ protocol = " TCP"
1048+ unhealthy_threshold = 2
1049+ }
1050+ name = " tcp-existingsg-example-co-jml1o0"
1051+ port = 443
1052+ protocol = " TCP"
1053+ tags = {
1054+ " KubernetesCluster" = " existingsg.example.com"
1055+ " Name" = " tcp-existingsg-example-co-jml1o0"
1056+ " kubernetes.io/cluster/existingsg.example.com" = " owned"
1057+ }
1058+ vpc_id = aws_vpc. existingsg-example-com . id
1059+ }
1060+
10371061resource "aws_route" "route-0-0-0-0--0" {
10381062 destination_cidr_block = " 0.0.0.0/0"
10391063 gateway_id = aws_internet_gateway. existingsg-example-com . id
@@ -1049,8 +1073,8 @@ resource "aws_route" "route-__--0" {
10491073resource "aws_route53_record" "api-existingsg-example-com" {
10501074 alias {
10511075 evaluate_target_health = false
1052- name = aws_elb . api-existingsg-example-com . dns_name
1053- zone_id = aws_elb . api-existingsg-example-com . zone_id
1076+ name = aws_lb . api-existingsg-example-com . dns_name
1077+ zone_id = aws_lb . api-existingsg-example-com . zone_id
10541078 }
10551079 name = " api.existingsg.example.com"
10561080 type = " A"
@@ -1060,8 +1084,8 @@ resource "aws_route53_record" "api-existingsg-example-com" {
10601084resource "aws_route53_record" "api-existingsg-example-com-AAAA" {
10611085 alias {
10621086 evaluate_target_health = false
1063- name = aws_elb . api-existingsg-example-com . dns_name
1064- zone_id = aws_elb . api-existingsg-example-com . zone_id
1087+ name = aws_lb . api-existingsg-example-com . dns_name
1088+ zone_id = aws_lb . api-existingsg-example-com . zone_id
10651089 }
10661090 name = " api.existingsg.example.com"
10671091 type = " AAAA"
0 commit comments