-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
37 lines (34 loc) · 1.3 KB
/
main.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
resource "aws_lb_listener" "listeners" {
for_each = {
for listener in local.listeners : "${listener.key}" => listener
}
load_balancer_arn = each.value.load_balancer_arn
port = each.value.port
protocol = each.value.protocol
ssl_policy = each.value.ssl_policy
certificate_arn = each.value.certificate_arn
alpn_policy = each.value.alpn_policy
dynamic "default_action" {
for_each = each.value.default_action == null ? [] : [1]
content {
type = each.value.default_action.type
//target_group_arn = each.value.default_action.target_group_arn == null ? null : TARGETGROUPHERE
dynamic "redirect" {
for_each = each.value.default_action.redirect == null ? [] : [1]
content {
port = each.value.default_action.redirect.port
protocol = each.value.default_action.redirect.protocol
status_code = each.value.default_action.redirect.status_code
}
}
dynamic "fixed_response" {
for_each = each.value.default_action.fixed_response == null ? [] : [1]
content {
content_type = each.value.default_action.fixed_response.content_type
message_body = each.value.default_action.fixed_response.message_body
status_code = each.value.default_action.fixed_response.status_code
}
}
}
}
}