forked from CSSE6400/P03-Brewbucks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadbalancer.tf
74 lines (64 loc) · 1.88 KB
/
loadbalancer.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
resource "aws_lb_target_group" "brewbucks" {
name = "brewbucks"
port = 80
protocol = "HTTP"
vpc_id = aws_security_group.brewbucks.vpc_id
target_type = "ip"
health_check {
path = "/api/v1/health"
port = "80"
protocol = "HTTP"
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 5
interval = 10
}
}
resource "aws_lb_target_group" "brewbucks-frontend" {
name = "brewbucks-frontend"
port = 80
protocol = "HTTP"
vpc_id = aws_security_group.brewbucks.vpc_id
target_type = "ip"
health_check {
path = "/"
port = "80"
protocol = "HTTP"
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 5
interval = 10
}
}
resource "aws_lb" "brewbucks-frontend" {
name = "brewbucks-frontend"
internal = false
load_balancer_type = "application"
subnets = data.aws_subnets.private.ids
security_groups = [aws_security_group.brewbucks.id]
}
resource "aws_lb_listener" "brewbucks-frontend" {
load_balancer_arn = aws_lb.brewbucks-frontend.arn
port = "80"
protocol = "HTTP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.brewbucks-frontend.arn
}
}
resource "aws_lb" "brewbucks" {
name = "brewbucks"
internal = false
load_balancer_type = "application"
subnets = data.aws_subnets.private.ids
security_groups = [aws_security_group.brewbucks.id]
}
resource "aws_lb_listener" "brewbucks" {
load_balancer_arn = aws_lb.brewbucks.arn
port = "80"
protocol = "HTTP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.brewbucks.arn
}
}