-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalb.tf
43 lines (37 loc) · 1.02 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
resource "aws_alb" "alb" {
name = "andrem-alb"
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.alb_sg.id]
subnets = module.vpc.public_subnets
enable_deletion_protection = false
enable_cross_zone_load_balancing = true
tags = {
Name = "andrem-alb"
}
}
resource "aws_alb_target_group" "alb_tg" {
name = "andrem-alb-tg"
port = 80
protocol = "HTTP"
vpc_id = module.vpc.vpc_id
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 20
interval = 60
path = "/docs"
}
tags = {
Name = "andrem-alb-tg"
}
}
resource "aws_alb_listener" "alb_listener" {
load_balancer_arn = aws_alb.alb.arn
port = "80"
protocol = "HTTP"
default_action {
target_group_arn = aws_alb_target_group.alb_tg.arn
type = "forward"
}
}