-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathelb.tf
36 lines (29 loc) · 948 Bytes
/
elb.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
# tfsec:ignore:aws-elb-alb-not-public
resource "aws_lb" "bastion" {
name_prefix = "${var.name_prefix}lb-"
internal = false
subnets = var.public_subnet_ids
load_balancer_type = "network"
tags = merge({ "Name" = "${var.name_prefix}lb" }, var.tags_default, var.tags_lb)
}
resource "aws_lb_target_group" "bastion_default" {
vpc_id = var.vpc_id
port = var.external_ssh_port
protocol = "TCP"
target_type = "instance"
preserve_client_ip = true
health_check {
port = 2345
protocol = "TCP"
}
tags = merge({ "Name" = "${var.name_prefix}lb" }, var.tags_default, var.tags_lb)
}
resource "aws_lb_listener" "bastion_ssh" {
load_balancer_arn = aws_lb.bastion.arn
port = var.external_ssh_port
protocol = "TCP"
default_action {
target_group_arn = aws_lb_target_group.bastion_default.arn
type = "forward"
}
}