From 545244341c32ae96f3a9604df3de166525861d74 Mon Sep 17 00:00:00 2001
From: Matthew Baggett <matthew@baggett.me>
Date: Mon, 3 Mar 2025 15:50:11 +0100
Subject: [PATCH] ports declarations should support publish_mode

---
 products/http2https/inputs.tf   | 7 ++++---
 products/iperf/inputs.tf        | 7 ++++---
 products/memcached/inputs.tf    | 7 ++++---
 products/mysql/inputs.tf        | 7 ++++---
 products/openhaystack/inputs.tf | 9 +++++----
 products/postgres/inputs.tf     | 7 ++++---
 6 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/products/http2https/inputs.tf b/products/http2https/inputs.tf
index 0c2ca52..ff0f96c 100644
--- a/products/http2https/inputs.tf
+++ b/products/http2https/inputs.tf
@@ -27,9 +27,10 @@ variable "networks" {
 }
 variable "ports" {
   type = list(object({
-    host      = optional(number)
-    container = number
-    protocol  = optional(string, "tcp")
+    host         = optional(number, null)
+    container    = number
+    protocol     = optional(string, "tcp")
+    publish_mode = optional(string, "ingress")
   }))
   default     = []
   description = "A map of port mappings to expose on the host. The key is the host port, and the value is the container port."
diff --git a/products/iperf/inputs.tf b/products/iperf/inputs.tf
index f6f320f..4e260ea 100644
--- a/products/iperf/inputs.tf
+++ b/products/iperf/inputs.tf
@@ -27,9 +27,10 @@ variable "networks" {
 }
 variable "ports" {
   type = list(object({
-    host      = optional(number)
-    container = number
-    protocol  = optional(string, "tcp")
+    host         = optional(number, null)
+    container    = number
+    protocol     = optional(string, "tcp")
+    publish_mode = optional(string, "ingress")
   }))
   default     = []
   description = "A map of port mappings to expose on the host. The key is the host port, and the value is the container port."
diff --git a/products/memcached/inputs.tf b/products/memcached/inputs.tf
index 3725d14..ba1cd97 100644
--- a/products/memcached/inputs.tf
+++ b/products/memcached/inputs.tf
@@ -42,9 +42,10 @@ variable "networks" {
 }
 variable "ports" {
   type = list(object({
-    host      = optional(number)
-    container = number
-    protocol  = optional(string, "tcp")
+    host         = optional(number, null)
+    container    = number
+    protocol     = optional(string, "tcp")
+    publish_mode = optional(string, "ingress")
   }))
   default     = []
   description = "A map of port mappings to expose on the host. The key is the host port, and the value is the container port."
diff --git a/products/mysql/inputs.tf b/products/mysql/inputs.tf
index ee2f6f4..04e6b86 100644
--- a/products/mysql/inputs.tf
+++ b/products/mysql/inputs.tf
@@ -52,9 +52,10 @@ variable "networks" {
 }
 variable "ports" {
   type = list(object({
-    host      = optional(number)
-    container = number
-    protocol  = optional(string, "tcp")
+    host         = optional(number, null)
+    container    = number
+    protocol     = optional(string, "tcp")
+    publish_mode = optional(string, "ingress")
   }))
   default     = []
   description = "A map of port mappings to expose on the host. The key is the host port, and the value is the container port."
diff --git a/products/openhaystack/inputs.tf b/products/openhaystack/inputs.tf
index 2ec4feb..b2b9041 100644
--- a/products/openhaystack/inputs.tf
+++ b/products/openhaystack/inputs.tf
@@ -16,10 +16,11 @@ variable "networks" {
   description = "A list of network names to attach the service to."
 } /*
 variable "ports" {
-  type = list(object({
-    host      = optional(number)
-    container = number
-    protocol  = optional(string, "tcp")
+    type = list(object({
+    host         = optional(number, null)
+    container    = number
+    protocol     = optional(string, "tcp")
+    publish_mode = optional(string, "ingress")
   }))
   default     = []
   description = "A map of port mappings to expose on the host. The key is the host port, and the value is the container port."
diff --git a/products/postgres/inputs.tf b/products/postgres/inputs.tf
index d490bee..de0a81e 100644
--- a/products/postgres/inputs.tf
+++ b/products/postgres/inputs.tf
@@ -47,9 +47,10 @@ variable "networks" {
 }
 variable "ports" {
   type = list(object({
-    host      = optional(number)
-    container = number
-    protocol  = optional(string, "tcp")
+    host         = optional(number, null)
+    container    = number
+    protocol     = optional(string, "tcp")
+    publish_mode = optional(string, "ingress")
   }))
   default     = []
   description = "A map of port mappings to expose on the host. The key is the host port, and the value is the container port."