From ee8ae023d050cb57e9c20a850293483c17449dd4 Mon Sep 17 00:00:00 2001 From: Ludovico Magnocavallo Date: Mon, 30 Mar 2026 09:24:58 +0200 Subject: [PATCH] fix(workstation-cluster): allow private_cluster_config to be null (#3821) Fixes #3819 by changing the default of `private_cluster_config` to `null` instead of an empty object, preventing the module from unintentionally generating an empty `private_cluster_config` block and treating the cluster as private when it wasn't requested. --- modules/workstation-cluster/README.md | 6 +++--- modules/workstation-cluster/variables.tf | 3 +-- tests/modules/workstation_cluster/context.yaml | 3 +-- .../modules/workstation_cluster/examples/custom-image.yaml | 3 +-- tests/modules/workstation_cluster/examples/iam.yaml | 3 +-- tests/modules/workstation_cluster/examples/simple.yaml | 3 +-- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/modules/workstation-cluster/README.md b/modules/workstation-cluster/README.md index c59cf17f3..7a513626e 100644 --- a/modules/workstation-cluster/README.md +++ b/modules/workstation-cluster/README.md @@ -175,15 +175,15 @@ module "workstation-cluster" { | [id](variables.tf#L59) | Workstation cluster ID. | string | ✓ | | | [location](variables.tf#L70) | Location. | string | ✓ | | | [network_config](variables.tf#L75) | Network configuration. | object({…}) | ✓ | | -| [project_id](variables.tf#L93) | Cluster ID. | string | ✓ | | +| [project_id](variables.tf#L92) | Cluster ID. | string | ✓ | | | [annotations](variables.tf#L17) | Workstation cluster annotations. | map(string) | | {} | | [context](variables.tf#L23) | Context-specific interpolations. | object({…}) | | {} | | [display_name](variables.tf#L38) | Display name. | string | | null | | [domain](variables.tf#L44) | Domain. | string | | null | | [factories_config](variables.tf#L50) | Path to folder with YAML resource description data files. | object({…}) | | {} | | [labels](variables.tf#L64) | Workstation cluster labels. | map(string) | | {} | -| [private_cluster_config](variables.tf#L83) | Private cluster config. | object({…}) | | {} | -| [workstation_configs](variables.tf#L98) | Workstation configurations. | map(object({…})) | | {} | +| [private_cluster_config](variables.tf#L83) | Private cluster config. | object({…}) | | null | +| [workstation_configs](variables.tf#L97) | Workstation configurations. | map(object({…})) | | {} | ## Outputs diff --git a/modules/workstation-cluster/variables.tf b/modules/workstation-cluster/variables.tf index 38f448aa3..e6678eea4 100644 --- a/modules/workstation-cluster/variables.tf +++ b/modules/workstation-cluster/variables.tf @@ -86,8 +86,7 @@ variable "private_cluster_config" { enable_private_endpoint = optional(bool, false) allowed_projects = optional(list(string)) }) - nullable = false - default = {} + default = null } variable "project_id" { diff --git a/tests/modules/workstation_cluster/context.yaml b/tests/modules/workstation_cluster/context.yaml index d3dda752f..887181bb8 100644 --- a/tests/modules/workstation_cluster/context.yaml +++ b/tests/modules/workstation_cluster/context.yaml @@ -41,8 +41,7 @@ values: labels: null location: europe-west8 network: projects/foo-dev-net-spoke-0/global/networks/dev-spoke-0 - private_cluster_config: - - enable_private_endpoint: false + private_cluster_config: [] project: dev-test-0 subnetwork: projects/foo-dev-net-spoke-0/regions/europe-west8/subnetworks/default tags: null diff --git a/tests/modules/workstation_cluster/examples/custom-image.yaml b/tests/modules/workstation_cluster/examples/custom-image.yaml index bb1917cfd..a4ea2ca4f 100644 --- a/tests/modules/workstation_cluster/examples/custom-image.yaml +++ b/tests/modules/workstation_cluster/examples/custom-image.yaml @@ -36,8 +36,7 @@ values: labels: null location: europe-west8 network: https://www.googleapis.com/compute/v1/projects/xxx/global/networks/aaa - private_cluster_config: - - enable_private_endpoint: false + private_cluster_config: [] project: project-id subnetwork: subnet_self_link timeouts: null diff --git a/tests/modules/workstation_cluster/examples/iam.yaml b/tests/modules/workstation_cluster/examples/iam.yaml index 0510cd355..9e858b143 100644 --- a/tests/modules/workstation_cluster/examples/iam.yaml +++ b/tests/modules/workstation_cluster/examples/iam.yaml @@ -37,8 +37,7 @@ values: labels: null location: europe-west8 network: https://www.googleapis.com/compute/v1/projects/xxx/global/networks/aaa - private_cluster_config: - - enable_private_endpoint: false + private_cluster_config: [] project: project-id subnetwork: subnet_self_link timeouts: null diff --git a/tests/modules/workstation_cluster/examples/simple.yaml b/tests/modules/workstation_cluster/examples/simple.yaml index cd3651f15..379b4362d 100644 --- a/tests/modules/workstation_cluster/examples/simple.yaml +++ b/tests/modules/workstation_cluster/examples/simple.yaml @@ -36,8 +36,7 @@ values: labels: null location: europe-west8 network: https://www.googleapis.com/compute/v1/projects/xxx/global/networks/aaa - private_cluster_config: - - enable_private_endpoint: false + private_cluster_config: [] project: project-id subnetwork: subnet_self_link timeouts: null