-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathingress.tf
More file actions
16 lines (14 loc) · 1.14 KB
/
ingress.tf
File metadata and controls
16 lines (14 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
locals {
// disable_main_port_mapping dictates whether the main container should map a port to the network
// If the user specifies service_port=0, then that will disable
// If a capability sidecar specifies as owns_service_port=true, then that will also disable
disable_main_port_mapping = !(var.port > 0) || anytrue(values(local.sidecars_owns_service_port))
cap_load_balancers = lookup(local.capabilities, "load_balancers", [])
cap_port_mappings = { for lb in local.cap_load_balancers : lb.port => { protocol = "tcp" } if lb.port != tostring(var.port) }
prelim_port_mappings = merge(tomap({ (var.port) = { protocol = "tcp" } }), local.cap_port_mappings)
// Exclude main port from all_port_mappings if disabled
all_port_mappings = { for port, obj in local.prelim_port_mappings : port => obj if !(port == tostring(var.port) && local.disable_main_port_mapping) }
// This strips the arn down to the target group name in the form: targetgroup/<name>/<id>
// This is useful for specifying target groups in cloudwatch metric alarms
target_group_arn_suffixes = [for lb in local.cap_load_balancers : element(split(":", lb.target_group_arn), 5)]
}