multi port working

This commit is contained in:
2025-05-18 00:01:43 +01:00
parent 48cc59e735
commit aa5826f6a4
2 changed files with 16 additions and 7 deletions
+15 -6
View File
@@ -205,10 +205,19 @@ resource "kubernetes_service" "automatic_service" {
selector = {
app = each.key
}
port {
port = each.value.service_port
target_port = each.value.service_port
dynamic "port" {
for_each = each.value.service_port != null ? each.value.service_port : []
content {
port = port.value
target_port = port.value
}
}
# port {
# port = each.value.service_port
# target_port = each.value.service_port
# }
type = each.value.service_type
@@ -298,10 +307,10 @@ resource "kubernetes_deployment_v1" "automatic" {
image = each.value.image
name = coalesce(each.value.name, each.key)
dynamic "port" {
for_each = each.value.service_port != null ? [""] : []
for_each = each.value.service_port != null ? each.value.service_port : []
content {
container_port = each.value.service_port
name = each.key
container_port = port.value
name = "${each.key}-${port.value}"
}
}