forked from rcove/aws-tgw-r8040
-
Notifications
You must be signed in to change notification settings - Fork 1
/
external_nlb.tf
66 lines (56 loc) · 1.64 KB
/
external_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
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
# Deploy external NLB
resource "aws_lb" "external_nlb" {
name = "${var.project_name}-External-NLB"
internal = false
load_balancer_type = "network"
subnets = aws_subnet.inbound_subnet.*.id
tags = {
name = "${var.project_name}-External-NLB"
}
}
resource "aws_lb_listener" "external_lb_listener" {
load_balancer_arn = aws_lb.external_nlb.arn
port = 80
protocol = "TCP"
default_action {
target_group_arn = aws_lb_target_group.external_lb_target_group.arn
type = "forward"
}
}
resource "aws_lb_target_group" "external_lb_target_group" {
name = "${var.project_name}-Ext-NLB-TG"
port = var.app_1_high_port
protocol = "TCP"
vpc_id = aws_vpc.inbound_vpc.id
tags = {
name = "${var.project_name}-Ext-NLB-TG"
}
}
# Deploy external NLB2
resource "aws_lb" "external_nlb2" {
name = "${var.project_name}-External-NLB2"
internal = false
load_balancer_type = "network"
subnets = aws_subnet.inbound_subnet.*.id
tags = {
name = "${var.project_name}-External-NLB2"
}
}
resource "aws_lb_listener" "external_lb_listener2" {
load_balancer_arn = aws_lb.external_nlb2.arn
port = 80
protocol = "TCP"
default_action {
target_group_arn = aws_lb_target_group.external_lb2_target_group.arn
type = "forward"
}
}
resource "aws_lb_target_group" "external_lb2_target_group" {
name = "${var.project_name}-Ext-NLB2-TG"
port = var.app_2_high_port
protocol = "TCP"
vpc_id = aws_vpc.inbound_vpc.id
tags = {
name = "${var.project_name}-Ext-NLB2-TG"
}
}