From 881c6132272d0d1ab3e6324069946a653d0c8147 Mon Sep 17 00:00:00 2001 From: Vijay Veeranki Date: Tue, 28 Sep 2021 09:39:21 +0100 Subject: [PATCH] Add terraform refresh to destroy eks_components This is to fix the authentication error, caused by this issue: https://github.com/hashicorp/terraform-provider-kubernetes/issues/1131 --- destroy-cluster.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/destroy-cluster.rb b/destroy-cluster.rb index ad1f7ebd..5e20afd5 100755 --- a/destroy-cluster.rb +++ b/destroy-cluster.rb @@ -193,6 +193,9 @@ def terraform_eks_components dir = "terraform/aws-accounts/cloud-platform-aws/vpc/eks/components" tf_init dir tf_workspace_select(dir, cluster_name) + # terraform refresh until this issue get fixed for terraform-provider-kubernetes + # https://github.com/hashicorp/terraform-provider-kubernetes/issues/1131 + tf_refresh(dir) tf_destroy(dir) end @@ -241,6 +244,10 @@ def tf_init(dir) execute "cd #{dir}; terraform init" end + def tf_refresh(dir) + execute "cd #{dir}; terraform refresh" + end + def tf_workspace_select(dir, workspace) execute "cd #{dir}; terraform workspace select #{workspace}" end