From d86de082d411db17465df03514d75864455214c3 Mon Sep 17 00:00:00 2001 From: Nick Charlton Date: Mon, 7 May 2018 16:11:29 +0100 Subject: [PATCH] Use the new "remove_default_node_pool" option. In the provider, #1245 was merged which allows us to remove the default node pool on cluster creation. Now, we just have to specify the default node pool name (the one which gets destroyed). https://github.com/terraform-providers/terraform-provider-google/pull/1245 --- gke.tf | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/gke.tf b/gke.tf index 884f444..64e319b 100644 --- a/gke.tf +++ b/gke.tf @@ -5,15 +5,13 @@ provider "google" { } resource "google_container_cluster" "primary" { - name = "gke-example" - zone = "europe-west2-a" + name = "gke-example" + zone = "europe-west2-a" + remove_default_node_pool = true - /* - node_pool = [{ - name = "default-pool" - node_count = 0 - }] - */ + node_pool { + name = "default-pool" + } } resource "google_container_node_pool" "primary_pool" { @@ -35,19 +33,4 @@ resource "google_container_node_pool" "primary_pool" { auto_repair = true auto_upgrade = true } - - # Delete the default node pool before spinning this one up - depends_on = ["null_resource.default_cluster_deleter"] -} - -resource "null_resource" "default_cluster_deleter" { - provisioner "local-exec" { - command = <