diff --git a/modules/gke-cluster/main.tf b/modules/gke-cluster/main.tf index ac66e46..65479bd 100644 --- a/modules/gke-cluster/main.tf +++ b/modules/gke-cluster/main.tf @@ -64,7 +64,7 @@ resource "google_container_cluster" "cluster" { ip_allocation_policy { // Choose the range, but let GCP pick the IPs within the range cluster_secondary_range_name = var.cluster_secondary_range_name - services_secondary_range_name = var.cluster_secondary_range_name + services_secondary_range_name = var.services_secondary_range_name != null ? var.services_secondary_range_name : var.cluster_secondary_range_name } # We can optionally control access to the cluster diff --git a/modules/gke-cluster/variables.tf b/modules/gke-cluster/variables.tf index fec621a..f80b83c 100644 --- a/modules/gke-cluster/variables.tf +++ b/modules/gke-cluster/variables.tf @@ -203,3 +203,9 @@ variable "enable_vertical_pod_autoscaling" { type = string default = false } + +variable "services_secondary_range_name" { + description = "The name of the secondary range within the subnetwork for the services to use" + type = string + default = null +}