terraform-google-modules / terraform-google-kubernetes-engine

Configures opinionated GKE clusters
https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google
Apache License 2.0
1.13k stars 1.16k forks source link

ASM Module Fails During Terraform Apply #628

Closed sp185503 closed 4 years ago

sp185503 commented 4 years ago

Getting the following error when I try a TF apply. Tried a few times and also did gcloud container clusters get-credentials prior to running TF commands in case this was an issue but still no luck.

terraform apply plan.json
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0]: Destroying... [id=6388934017989908827]
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0]: Destruction complete after 0s
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0]: Creating...
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0]: Provisioning with 'local-exec'...
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): Executing: ["/bin/sh" "-c" "PATH=/google-cloud-sdk/bin:$PATH\n.terraform/modules/asm-asm-conf-us-central1-1.asm_install/terraform-google-gcloud-1.4.1/modules/kubectl-wrapper/scripts/kubectl_wrapper.sh asm-conf-us-central1-1 us-central1 sre-global-demo false false .terraform/modules/asm-asm-conf-us-central1-1/terraform-google-kubernetes-engine-11.0.0/modules/asm/scripts/install_asm.sh mysuperprj asm-conf-us-central1-1 us-central1 asm-dir release-1.6-asm\n"]
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): Fetching cluster endpoint and auth data.
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): kubeconfig entry generated for asm-conf-us-central1-1.
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): ~/mysuperprj-tf/gke/asm-dir ~/mysuperprj-tf/gke
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): Updated property [core/project].
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): ASM patch directory exists. Skipping download...
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): ERROR: (gcloud.beta.anthos) Invalid choice: 'export'.
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): Maybe you meant:
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec):   gcloud anthos auth login

module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec): To search the help text of gcloud commands, run:
module.asm-asm-conf-us-central1-1.module.asm_install.module.gcloud_kubectl.null_resource.run_command[0] (local-exec):   gcloud help -- SEARCH_TERMS

Error: Error running command 'PATH=/google-cloud-sdk/bin:$PATH
.terraform/modules/asm-asm-conf-us-central1-1.asm_install/terraform-google-gcloud-1.4.1/modules/kubectl-wrapper/scripts/kubectl_wrapper.sh asm-conf-us-central1-1 us-central1 sre-global-demo false false .terraform/modules/asm-asm-conf-us-central1-1/terraform-google-kubernetes-engine-11.0.0/modules/asm/scripts/install_asm.sh mysuperprj asm-conf-us-central1-1 us-central1 asm-dir release-1.6-asm
': exit status 2. Output: Fetching cluster endpoint and auth data.
kubeconfig entry generated for asm-conf-us-central1-1.
~/mysuperprj-tf/gke/asm-dir ~/mysuperprj-tf/gke
Updated property [core/project].
ASM patch directory exists. Skipping download...
ERROR: (gcloud.beta.anthos) Invalid choice: 'export'.
Maybe you meant:
  gcloud anthos auth login

To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS
morgante commented 4 years ago

What version of gcloud do you have installed? You might want to try updating it.

morgante commented 4 years ago

@bharathkkb Can you PTAL?

sp185503 commented 4 years ago

I personally have an older version.

gcloud info
Google Cloud SDK [288.0.0]
morgante commented 4 years ago

@sp185503 Can you upgrade to the latest version and see if you still encounter this issue?

bharathkkb commented 4 years ago

@sp185503 yes this is due to older gcloud. Could you try an update or set skip_gcloud_download=false? https://cloud.google.com/sdk/docs/release-notes#29500_2020-06-02

sp185503 commented 4 years ago

@bharathkkb Upgrading gcloud actually worked. Thanks again!

bharathkkb commented 4 years ago

@sp185503 np glad it worked out 😄 . We should probably include this in the readme.