-
Notifications
You must be signed in to change notification settings - Fork 2
/
locals.tf
38 lines (35 loc) · 1.07 KB
/
locals.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
locals {
tcp_services_tuple = flatten([
for service_name, values in var.tcp_services : {
key=(values.ingress_port)
val="${values.namespace}/${values.service_name}:${values.container_port}"
}
])
tcp_services_map = { for item in local.tcp_services_tuple: item.key => item.val }
}
locals {
udp_services_tuple = flatten([
for service_name, values in var.udp_services : {
key=(values.ingress_port)
val="${values.namespace}/${values.service_name}:${values.container_port}"
}
])
udp_services_map = { for item in local.udp_services_tuple: item.key => item.val }
}
locals {
lb_ports=concat(concat( flatten([
for service_name, values in var.tcp_services : {
name="${service_name}tcp"
port=values.ingress_port
target_port=values.ingress_port
protocol="TCP"
}
]),flatten([
for service_name, values in var.udp_services : {
name="${service_name}udp"
port=values.ingress_port
target_port=values.ingress_port
protocol="UDP"
}
])),var.lb_ports)
}