-
Notifications
You must be signed in to change notification settings - Fork 3
/
internal_lb_app2.tf
42 lines (37 loc) · 1.5 KB
/
internal_lb_app2.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
# Deploy internal LB for app2
resource "aws_lb" "internal_aws_lb_app2" {
name = "${var.project_name}-Internal-NLB-app2"
internal = true
load_balancer_type = "network"
subnets = ["${aws_subnet.spoke_1a_external_subnet.*.id}"]
tags = {
Environment = "${var.project_name}-Internal_NLB_app2"
x-chkp-forwarding = "TCP-${var.app_2_high_port}-80"
x-chkp-management = "${var.template_management_server_name}"
x-chkp-template = "${var.inbound_configuration_template_name}"
}
}
resource "aws_lb_listener" "internal_lb_listener_app2" {
load_balancer_arn = "${aws_lb.internal_aws_lb_app2.arn}"
port = 80
protocol = "TCP"
default_action {
target_group_arn = "${aws_lb_target_group.internal_lb_target_group_app2.arn}"
type = "forward"
}
}
resource "aws_lb_target_group" "internal_lb_target_group_app2" {
name = "${var.project_name}-Int-NLB-TG-app2"
port = "80"
protocol = "TCP"
vpc_id = "${aws_vpc.spoke_1a_vpc.id}"
tags {
name = "${var.project_name}-Int-NLB-TG-app2"
}
}
resource "aws_lb_target_group_attachment" "internal_lb_target_group_attachment_app2" {
count = "${aws_instance.spoke_1a_instance.count}"
target_group_arn = "${aws_lb_target_group.internal_lb_target_group_app2.arn}"
target_id = "${element(aws_instance.spoke_1a_instance.*.id, count.index)}"
port = 80
}