-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
local-exec provisioner error (exit status 127. Output: /bin/sh: 1: gcloud: not found) #10081
Comments
@Knoparast This might be a question for Have you tried resource "null_resource" "default" {
provisioner "local-exec" {
command = "gcloud compute instances list"
}
} |
@edwardmedia The "terraform apply" runs successfully when I try the terraform locally since I have Cloud SDK on my machine: ...... But on Cloud I get the same issue: Error: local-exec provisioner error I found similar issues on Google GitHub like[1], so my assumption was that you may have a fix/workaround for it. [1] terraform-google-modules/terraform-google-kubernetes-engine#721 |
@Knoparast shouldn't we think this is an Terraform Cloud issue? This is the place where we focus on the
|
It seems Terraform Cloud env doesn't install gcloud. I resolved the issue via using gcloud module: module "gcloud" { use_tf_google_credentials_env_var = true create_cmd_entrypoint = "gcloud" Posting the resolution here for others may have similar issue. I go ahead and close this ticket. Thanks. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
I am using Terraform Cloud with the following config:
terraform {
required_version = ">= 0.14"
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.50"
} } }
Affected Resource(s)
Terraform Configuration Files
Issue Summary
Have added the following Environment Variables in my workspace:
GOOGLE_CREDENTIALS set to my SA key
GCLOUD_TF_DOWNLOAD set to always
All the resources get created in my project but it fails to run the gcloud command and throws the following error:
Error: local-exec provisioner error
with null_resource.default
on clusters.tf line 35, in resource "null_resource" "default":
provisioner "local-exec" {
Error running command 'gcloud compute instance-groups set-named-ports https://www.googleapis.com/compute/v1/projects/REDACTED/zones/us-central1-c/instanceGroups/gke-REDACTED-grp --named-ports=http:30000 --format=json': exit status 127. Output: /bin/sh: 1: gcloud: not found
Expected Behavior
The terraform runs properly when I apply it locally but in Terraform Cloud it fails running the "local-exec provisioner". I expect the terraform get applied successfully in Terraform Cloud as well.
The text was updated successfully, but these errors were encountered: