-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtarget_groups.tf
35 lines (28 loc) · 1017 Bytes
/
target_groups.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
resource "aws_lb_target_group" "target_group" {
for_each = {
for target_group in var.target_groups : target_group.key => target_group
}
vpc_id = var.vpc_id
port = each.value.port
protocol = each.value.protocol
target_type = each.value.target_type
deregistration_delay = each.value.deregistration_delay
health_check {
path = each.value.health_check.path
port = each.value.health_check.port
protocol = each.value.health_check.protocol
interval = each.value.health_check.interval
healthy_threshold = each.value.health_check.healthy_threshold
unhealthy_threshold = each.value.health_check.unhealthy_threshold
}
tags = {
Name = "${var.component}-${var.deployment_identifier}-${each.value.port}-${each.value.protocol}"
Component = var.component
DeploymentIdentifier = var.deployment_identifier
}
# this dependency is required to ensure the target group has an LB before it
# can be used by a dependent
depends_on = [
aws_lb.load_balancer
]
}