-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnlb.tf
40 lines (30 loc) · 1023 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
37
38
39
40
resource "aws_lb" "nlb" {
internal = false
load_balancer_type = "network"
subnets = [module.firewall-vpc.public_subnets[0], module.firewall-vpc.public_subnets[1]]
enable_deletion_protection = false
}
resource "aws_lb_listener" "nlb" {
load_balancer_arn = aws_lb.nlb.arn
port = "80"
protocol = "TCP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.firewall.arn
}
}
resource "aws_lb_target_group" "firewall" {
port = 80
protocol = "TCP"
vpc_id = module.firewall-vpc.vpc_id
}
resource "aws_alb_target_group_attachment" "firewall_attach1" {
target_group_arn = aws_lb_target_group.firewall.arn
target_id = aws_instance.firewall1.id
port = 80
}
resource "aws_alb_target_group_attachment" "firewall_attach2" {
target_group_arn = aws_lb_target_group.firewall.arn
target_id = aws_instance.firewall2.id
port = 80
}