From b2f7df6d7783675fbc21330712cd9504e4e98e24 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 18 Aug 2018 15:19:09 -0700 Subject: [PATCH] terraform/gke: clean up kubeconfig better, still not perfect --- terraform/modules/gke/main.tf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/terraform/modules/gke/main.tf b/terraform/modules/gke/main.tf index 3767f4e..6281c82 100644 --- a/terraform/modules/gke/main.tf +++ b/terraform/modules/gke/main.tf @@ -36,4 +36,10 @@ resource "null_resource" "kubectl" { on_failure = "continue" command = "kubectl config get-clusters | grep ${google_container_cluster.cluster.name} | xargs -n1 kubectl config delete-cluster" } + + provisioner "local-exec" { + when = "destroy" + on_failure = "continue" + command = "kubectl config get-contexts | grep ${google_container_cluster.cluster.name} | xargs -n1 kubectl config delete-context" + } }