diff --git a/blueprints/networking/shared-vpc-gke/main.tf b/blueprints/networking/shared-vpc-gke/main.tf index 2e770377f1..b176cced34 100644 --- a/blueprints/networking/shared-vpc-gke/main.tf +++ b/blueprints/networking/shared-vpc-gke/main.tf @@ -221,12 +221,12 @@ module "cluster-1" { } module "cluster-1-nodepool-1" { - source = "../../../modules/gke-nodepool" - count = var.cluster_create ? 1 : 0 - name = "nodepool-1" - project_id = module.project-svc-gke.project_id - location = module.cluster-1.0.location - cluster_name = module.cluster-1.0.name + source = "../../../modules/gke-nodepool" + count = var.cluster_create ? 1 : 0 + name = "nodepool-1" + project_id = module.project-svc-gke.project_id + location = module.cluster-1.0.location + cluster_id = module.cluster-1.0.id service_account = { create = true } diff --git a/modules/gke-cluster/main.tf b/modules/gke-cluster/main.tf index 3ef14391a1..5b5cd95f3a 100644 --- a/modules/gke-cluster/main.tf +++ b/modules/gke-cluster/main.tf @@ -17,7 +17,8 @@ resource "google_container_cluster" "cluster" { lifecycle { ignore_changes = [ - node_config[0].boot_disk_kms_key + node_config[0].boot_disk_kms_key, + node_config[0].spot ] } provider = google-beta diff --git a/modules/gke-nodepool/main.tf b/modules/gke-nodepool/main.tf index 0c35c8d0f8..ad0c053f35 100644 --- a/modules/gke-nodepool/main.tf +++ b/modules/gke-nodepool/main.tf @@ -70,7 +70,7 @@ resource "google_service_account" "service_account" { resource "google_container_node_pool" "nodepool" { provider = google-beta project = var.project_id - cluster = var.cluster_name + cluster = coalesce(var.cluster_id, var.cluster_name) location = var.location name = var.name version = var.gke_version diff --git a/modules/gke-nodepool/variables.tf b/modules/gke-nodepool/variables.tf index 15c8a15155..9a0ca1be47 100644 --- a/modules/gke-nodepool/variables.tf +++ b/modules/gke-nodepool/variables.tf @@ -14,9 +14,16 @@ * limitations under the License. */ +variable "cluster_id" { + description = "Cluster id. Either cluster_id or cluster_name must be provided. Providing cluster_id is recommended." + type = string + default = null +} + variable "cluster_name" { - description = "Cluster name." + description = "Cluster name. Either cluster_id or cluster_name must be provided. Providing cluster_id is recommended." type = string + default = null } variable "gke_version" {