From 95a33a574324051b4f2c552d78c80520029af1e3 Mon Sep 17 00:00:00 2001 From: Eugene Storchevoy Date: Mon, 30 Mar 2020 13:11:14 +0200 Subject: [PATCH 1/2] added var.services_secondary_range_name --- modules/gke-cluster/main.tf | 2 +- modules/gke-cluster/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/gke-cluster/main.tf b/modules/gke-cluster/main.tf index ac66e46..107118c 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 != "" ? 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..9d93b07 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 = "" +} From 89e4f93fe3da1de104e1f5cd2df75ed4c5ac80ab Mon Sep 17 00:00:00 2001 From: Eugene Storchevoy Date: Tue, 31 Mar 2020 18:13:08 +0200 Subject: [PATCH 2/2] fixes after CR: default services_secondary_range_name to null. --- modules/gke-cluster/main.tf | 2 +- modules/gke-cluster/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gke-cluster/main.tf b/modules/gke-cluster/main.tf index 107118c..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.services_secondary_range_name != "" ? var.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 9d93b07..f80b83c 100644 --- a/modules/gke-cluster/variables.tf +++ b/modules/gke-cluster/variables.tf @@ -207,5 +207,5 @@ variable "enable_vertical_pod_autoscaling" { variable "services_secondary_range_name" { description = "The name of the secondary range within the subnetwork for the services to use" type = string - default = "" + default = null }