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 = { selector = {
app = each.key app = each.key
} }
port { dynamic "port" {
port = each.value.service_port for_each = each.value.service_port != null ? each.value.service_port : []
target_port = 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 type = each.value.service_type
@@ -298,10 +307,10 @@ resource "kubernetes_deployment_v1" "automatic" {
image = each.value.image image = each.value.image
name = coalesce(each.value.name, each.key) name = coalesce(each.value.name, each.key)
dynamic "port" { dynamic "port" {
for_each = each.value.service_port != null ? [""] : [] for_each = each.value.service_port != null ? each.value.service_port : []
content { content {
container_port = each.value.service_port container_port = port.value
name = each.key name = "${each.key}-${port.value}"
} }
} }
+1 -1
View File
@@ -6,7 +6,7 @@ kubernetes = {
extra_manifest = ["/opt/kubernetes/Bookstack_kube/Bookstack.configmap.yaml", "/opt/kubernetes/Bookstack_kube/Bookstack.secret.yaml"] extra_manifest = ["/opt/kubernetes/Bookstack_kube/Bookstack.configmap.yaml", "/opt/kubernetes/Bookstack_kube/Bookstack.secret.yaml"]
#image = "linuxserver/bookstack:24.10.3" #image = "linuxserver/bookstack:24.10.3"
image = "linuxserver/bookstack:latest" image = "linuxserver/bookstack:latest"
service_port = [80] service_port = [80,443]
database = { database = {
"image" = "lscr.io/linuxserver/mariadb" "image" = "lscr.io/linuxserver/mariadb"
"port" = 3306 "port" = 3306