forked from techservicesillinois/terraform-aws-ecs-service
-
Notifications
You must be signed in to change notification settings - Fork 1
/
listener_rule.tf
46 lines (38 loc) · 989 Bytes
/
listener_rule.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
# A listener rule is created only if a load balancer is in use
resource "aws_alb_listener_rule" "default" {
count = length(var.load_balancer) > 0 && local.priority == 0 ? 1 : 0
listener_arn = data.aws_lb_listener.selected[0].arn
action {
type = "forward"
target_group_arn = aws_lb_target_group.default[0].arn
}
condition {
path_pattern {
values = [local.path_pattern]
}
}
condition {
host_header {
values = [local.host_header]
}
}
}
resource "aws_alb_listener_rule" "set_priority" {
count = length(var.load_balancer) > 0 && local.priority > 0 ? 1 : 0
listener_arn = data.aws_lb_listener.selected[0].arn
priority = local.priority
action {
type = "forward"
target_group_arn = aws_lb_target_group.default[0].arn
}
condition {
path_pattern {
values = [local.path_pattern]
}
}
condition {
host_header {
values = [local.host_header]
}
}
}