Skip to content

Commit

Permalink
fix terraform destroy failure on aws (#2148)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielZhangQD authored Apr 10, 2020
1 parent 9076194 commit 6fece6a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion deploy/modules/aws/tidb-operator/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<EOS
echo "${local_file.kubeconfig.sensitive_content}" > "${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
}
}

Expand Down

0 comments on commit 6fece6a

Please sign in to comment.