-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnlb.tf
36 lines (31 loc) · 845 Bytes
/
nlb.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
resource "aws_lb" "lb" {
name = "load-balancer"
internal = true
load_balancer_type = "network"
subnets = module.chroma_network.subnet_ids
}
resource "aws_lb_target_group" "lbtg" {
name = "load-balancer-target-group"
port = 8000
protocol = "TCP"
vpc_id = aws_vpc.base_vpc.id
health_check {
enabled = true
protocol = "HTTP"
path = "/"
}
}
resource "aws_lb_target_group_attachment" "lbtga" {
target_group_arn = aws_lb_target_group.lbtg.arn
target_id = aws_instance.chroma_instance.id
port = 8000
}
resource "aws_lb_listener" "lbl" {
load_balancer_arn = aws_lb.lb.arn
port = "8000"
protocol = "TCP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.lbtg.arn
}
}