-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathload_balancers.tf
More file actions
36 lines (33 loc) · 1.13 KB
/
load_balancers.tf
File metadata and controls
36 lines (33 loc) · 1.13 KB
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 "random_uuid" "aws_elb_postfix" {}
resource "aws_elb" "ingress" { #tfsec:ignore:AWS005
// The format of the name here is complicated because the max length of ELB names is 32 chars and
// using name_prefix adds 26 chars to the end, leaving only 6 chars for the prefix. This line is saying
// that the prefix can be up to 24 chars and the rest gets a truncated uuid
name = substr(format("%s-%s", format("%.23s", module.label.id), replace(random_uuid.aws_elb_postfix.result, "-", "")), 0, 32)
subnets = var.subnet_ids
security_groups = [aws_security_group.ingress_elb.id]
listener {
instance_port = 80
instance_protocol = "tcp"
lb_port = 80
lb_protocol = "tcp"
}
listener {
instance_port = 443
instance_protocol = "tcp"
lb_port = 443
lb_protocol = "tcp"
}
health_check {
healthy_threshold = 2
interval = 5
target = "HTTP:80/healthz"
timeout = 2
unhealthy_threshold = 2
}
idle_timeout = 1800
depends_on = [
rancher2_cluster.default
]
tags = module.label.tags
}