Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to execute the script wait-for-cluster.sh #413

Closed
taruntmr opened this issue Jan 30, 2020 · 13 comments
Closed

Not able to execute the script wait-for-cluster.sh #413

taruntmr opened this issue Jan 30, 2020 · 13 comments

Comments

@taruntmr
Copy link

Hi,

I am facing issue when consuming the module private-cluster. I get the following error:

[0m�[0mmodule.k8s-private-cluster.null_resource.wait_for_cluster[0] (local-exec): /bin/sh: terraform-google-kubernetes-engine/modules/private-cluster/scripts/wait-for-cluster.sh: not found

I am using the hashicorp/terraform:0.12.16 image.

I connected to the running container and tried executing the file manually but I got the same error.

I validated the permission on the file, they are +x.

Let me know if you would want more details.

Thanks,
Tarun

@rohitgabrieleit
Copy link

Facing the same issue, any thoughts on how to resolve this?

@morgante
Copy link
Contributor

morgante commented Mar 4, 2020

I'm not really sure what could be causing this truthfully. It looks like the script is there, yet it's somehow not being executed?

Could you try directly executing the script (outside Terraform)?

@rohitgabrieleit
Copy link

I am using Terraform cloud, so that's not an option

@rohitgabrieleit
Copy link

Is this a consequence of
gcloud executable requirement, removal of jq #401 . #401

@rohitgabrieleit
Copy link

Error: Error running command '.terraform/modules/gke/terraform-google-modules-terraform-google-kubernetes-engine-1d4c858/scripts/wait-for-cluster.sh friendly-path-269502 simple-regional-cluster-pih-sandbox': exit status 127.
Output: Waiting for cluster simple-regional-cluster-pih-sandbox in project friendly-path-269502 to reconcile...

.terraform/modules/gke/terraform-google-modules-terraform-google-kubernetes-engine-1d4c858/scripts/wait-for-cluster.sh: line 28: gcloud: command not found

@mouglou
Copy link

mouglou commented Mar 11, 2020

I get the same issue... The cluster is good, but the job is marked as "passed with warnings" in my Gitlab CICD. So not really cool ;)

I try few thinkgs but don't find a solution for now

I add an "ls" and try to execute the script manually without success.

$ ls -al .terraform/modules/gke/terraform-google-modules-terraform-google-kubernetes-engine-1d4c858/modules/private-cluster/scripts/
57 total 20
58 drwxrwxr-x    2 root     root          4096 Feb 19 16:23 .
59 drwxrwxr-x    3 root     root          4096 Feb 19 16:23 ..
60 -rwxrwxr-x    1 root     root          1585 Feb 19 16:23 delete-default-resource.sh
61 -rwxrwxr-x    1 root     root          1573 Feb 19 16:23 kubectl_wrapper.sh
62 -rwxrwxr-x    1 root     root          1236 Feb 19 16:23 wait-for-cluster.sh
63 $ .terraform/modules/gke/terraform-google-modules-terraform-google-kubernetes-engine-1d4c858/modules/private-cluster/scripts/wait-for-cluster.sh coretech-ludia luna-gke-srvr-01
64 /bin/sh: eval: line 97: .terraform/modules/gke/terraform-google-modules-terraform-google-kubernetes-engine-1d4c858/modules/private-cluster/scripts/wait-for-cluster.sh: not found

@morgante
Copy link
Contributor

I suspect the issue might be running in an environment where bash is not available. We should change the script to specify /bin/sh instead of /bin/bash: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/master/autogen/main/scripts/wait-for-cluster.sh#L1

@mouglou
Copy link

mouglou commented Mar 16, 2020

Just to let you know, I try to change my gitlab-runner from "docker" to "shell" and with that, the script is working fine. So maybe the "not found" is coming from the "gcloud" package that is missing in the "terraform:light" docker image.

@dexter0195
Copy link

I suspect the issue might be running in an environment where bash is not available. We should change the script to specify /bin/sh instead of /bin/bash: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/master/autogen/main/scripts/wait-for-cluster.sh#L1

My issue was exactly that, I am running terraform in a docker container and bash was not available.
Installing bash solved the issue

@mbrowne
Copy link

mbrowne commented Sep 17, 2020

For me, this error went away when I copied all the files in this module to a local directory, source = "./beta-private-cluster" (instead of source = "terraform-google-modules/kubernetes-engine/google//modules/beta-private-cluster").

I'm also using terragrunt, so that might be a complicating factor.

Earlier I had tried setting skip_provisioners = false, which supposedly should have prevented it from running the shell scripts (including wait-for-cluster), but it was still complaining that wait-for-cluster.sh wasn't found.

@llnformer
Copy link

any idea how to overcome the issue of not having the gcloud command when running in Terraform Cloud environment?

@bharathkkb
Copy link
Member

Hi @llnformer
skip_provisioners = false should now let you skip wait-for-cluster.sh, there was a bug that was fixed by #669

Additionally with the 12.0 release, if you set the GCLOUD_TF_DOWNLOAD env var, this module will attempt to download and install gcloud. More details here https://github.com/terraform-google-modules/terraform-google-kubernetes-engine#gcloud

Closing this issue out now, feel free to reopen if needed.

@jai
Copy link

jai commented Dec 15, 2020

skip_provisioners = false should now let you skip wait-for-cluster.sh, there was a bug that was fixed by #669

@bharathkkb you mean skip_provisioners = true yeah? Or am I misunderstanding?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants