11resource "aws_acm_certificate" "central_lb_cert" {
2- domain_name = " j4numbers.co.uk "
2+ domain_name = var . dns_hosted_zones [ local . dev-env ]
33 validation_method = " DNS"
44
55 lifecycle {
@@ -8,45 +8,41 @@ resource "aws_acm_certificate" "central_lb_cert" {
88}
99
1010resource "aws_lb" "central_load_balancer" {
11- name = " ${ local . dev-env } -central-alb"
11+ name = " ${ local . dev-env } -${ var . application_name } - central-alb"
1212 internal = false
1313 load_balancer_type = " application"
14- security_groups = [" ${ aws_security_group . personal_website . id } " ]
15- subnets = [" ${ data . aws_subnet_ids . root_vpc_subnets . ids } " ]
14+ security_groups = [aws_security_group . personal_website_sg . id ]
15+ subnets = [data . aws_subnet_ids . root_vpc_subnets . ids ]
1616
1717 enable_deletion_protection = false
1818 enable_http2 = true
19-
20- tags {
21- Environment = " ${ local . dev-env } "
22- }
2319}
2420
2521resource "aws_lb_target_group" "central_lb_targets" {
26- name = " ${ local . dev-env } -personal-website "
27- port = " ${ var . application_port } "
22+ name = " ${ local . dev-env } -${ var . application_name } "
23+ port = var. application_port
2824 protocol = " TCP"
29- vpc_id = " ${ data . aws_subnet . personal_website_subnet . 0 . vpc_id } "
25+ vpc_id = data. aws_subnet . personal_website_subnet [ 0 ] . vpc_id
3026 deregistration_delay = 60
3127
3228 health_check {
3329 healthy_threshold = 2
3430 unhealthy_threshold = 2
3531 interval = 10
36- port = " ${ var . application_port } "
32+ port = var. application_port
3733 protocol = " TCP"
3834 }
3935}
4036
4137resource "aws_lb_listener" "https_listener" {
42- load_balancer_arn = " ${ aws_lb . central_load_balancer . arn } "
38+ load_balancer_arn = aws_lb. central_load_balancer . arn
4339 port = 8080
4440 protocol = " HTTPS"
4541 ssl_policy = " ELBSecurityPolicy-2016-08"
46- certificate_arn = " ${ aws_acm_certificate . central_lb_cert . arn } "
42+ certificate_arn = aws_acm_certificate. central_lb_cert . arn
4743
4844 default_action {
4945 type = " forward"
50- target_group_arn = " ${ aws_lb_target_group . central_lb_targets . arn } "
46+ target_group_arn = aws_lb_target_group. central_lb_targets . arn
5147 }
5248}
0 commit comments