-
Notifications
You must be signed in to change notification settings - Fork 95
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
terraform-google-gcloud does not run on Windows #84
Comments
Thanks for the feedback, unfortunately this a bit tricky. Most likely real Windows support will require separate .cmd files.
Unfortunately this only works if this module were your "root module." However this module is most commonly embedded inside other modules, in which case we don't have native access to Terraform environment variables.
This ends up slowing down execution substantially and is something we'd definitely like to avoid. |
Thanks for the response. My use case is "develop and test to test project on windows" and "deploy to production with on linux", while others simultaneously develop and test on mac. To address that use case, the tool doesn't even need to have install working at all on Windows, it's fine to say it's required beforehand. So it might simplify things if it detects the OS and disables install there. Note that after further investigation, I probably don't need this module, so this is low priority to me, but it may be helpful to others. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
I'd like this to be reopened as I encounter the exact same issue. Is there any no hacky way to get the module work on windows? |
The terraform-google-gcloud module does not run on Windows due to a reliance on shell scripts.
Repro
Run, say,
terraform plan
for a config which uses terraform-google-gcloud.Result
Error: failed to execute ".terraform/modules/my_rule/scripts/check_env.sh": fork/exec .terraform/modules/my_rule/scripts/check_env.sh: %1 is not a valid Win32 application.
Expected
Terraform to run the gcloud or other command specified in the Terraform config.
The documentation says the requirements are
All of these run well on Windows, as does the gcloud command line tool.
Proof of concept
It appears to work with these tweaks to main.tf:
This demonstrates that the concept works fine on Windows, though of course these changes are not suitable to be committed.
Possible cross-platform fixes
I am a Terraform novice, so take these with a big grain of salt.
gcloud components install
.gcloud_bin_abs_path
. Note that if the install cache isn't being used, this prefix would be the empty string "", to use the version on the existing path.Another possibility would be to create .cmd files parallel to the .sh files.
Alternate or interim solution
Document that a sh interpreter is required.
The text was updated successfully, but these errors were encountered: