From 6fece6a8c0692ee436acdd10ce3c6855c9c28981 Mon Sep 17 00:00:00 2001 From: DanielZhangQD <36026334+DanielZhangQD@users.noreply.github.com> Date: Fri, 10 Apr 2020 17:45:39 +0800 Subject: [PATCH] fix terraform destroy failure on aws (#2148) --- deploy/modules/aws/tidb-operator/main.tf | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/deploy/modules/aws/tidb-operator/main.tf b/deploy/modules/aws/tidb-operator/main.tf index 78e4b76334..c3d5badd32 100644 --- a/deploy/modules/aws/tidb-operator/main.tf +++ b/deploy/modules/aws/tidb-operator/main.tf @@ -37,13 +37,27 @@ resource "local_file" "kubeconfig" { filename = module.eks.kubeconfig_filename } +locals { + kubeconfig = "${var.config_output_path}kubeconfig" +} + +resource "null_resource" "kubeconfig" { + provisioner "local-exec" { + command = < "${local.kubeconfig}" +EOS + } +} + provider "helm" { alias = "initial" insecure = true # service_account = "tiller" install_tiller = false # currently this doesn't work, so we install tiller in the local-exec provisioner. See https://github.com/terraform-providers/terraform-provider-helm/issues/148 kubernetes { - config_path = local_file.kubeconfig.filename + config_path = local.kubeconfig + # used to delay helm provisioner initialization in apply phrase + load_config_file = null_resource.kubeconfig.id != "" ? true : null } }