-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalb.tf
52 lines (43 loc) · 1.23 KB
/
alb.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
module "alb_sg" {
source = "terraform-aws-modules/security-group/aws"
version = "3.18.0"
vpc_id = module.vpc.vpc_id
name = "${var.name_prefix}-alb-sg"
use_name_prefix = false
description = "Access to public Application Load Balancer"
ingress_rules = ["http-80-tcp", "https-443-tcp"]
ingress_cidr_blocks = ["0.0.0.0/0"]
egress_cidr_blocks = ["0.0.0.0/0"]
egress_rules = ["all-all"]
tags = var.common_tags
}
module "alb" {
source = "terraform-aws-modules/alb/aws"
version = "5.16.0"
name = "${var.name_prefix}-public-alb"
load_balancer_type = "application"
vpc_id = module.vpc.vpc_id
subnets = module.vpc.public_subnets
security_groups = [module.alb_sg.this_security_group_id]
http_tcp_listeners = [
{
port = 80
protocol = "HTTP"
target_group_index = 0
}
]
target_groups = [
{
name = "${var.name_prefix}-ecs-svc-blue"
backend_protocol = "HTTP"
backend_port = var.container_port
target_type = "ip"
health_check = {
enabled = true
path = "/"
matcher = "200,302"
}
}
]
tags = var.common_tags
}