-
-
Notifications
You must be signed in to change notification settings - Fork 541
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 hook fails when the terraform binary's path contains a space #713
Comments
Issue appears to be started occurring from v1.90.0 when custom tf / tofu path is introduced. |
@walkerk1980 Can you please try the fix in #714? |
The quoting $tf_path on line 52 of hooks/terraform_fmt.sh does indeed fix the first instance of the error. 'terraform init' failed, '/home/user1/work/applications/it_infra_tf_ccoe_app_bstrp_test/path/w ith/space/terraform validate' skipped: .
/home/user1/.cache/pre-commit/reposq7m00vx/hooks/_common.sh: line 539: /home/user1/work/applications/it_infra_tf_ccoe_app_bstrp_test/path/w: No such file or directory
Validation failed: terraform
/home/user1/.cache/pre-commit/reposq7m00vx/hooks/terraform_validate.sh: line 135: /home/user1/work/applications/it_infra_tf_ccoe_app_bstrp_test/path/w: No such file or directory My errors are fixed entirely after quoting all unquoted instances of $tf_path in both hooks/_common.sh and hooks/terraform_validate.sh. Note that I did not need to quote all instances to get successful result, only the line numbers mentioned in the errors above, but was still successful after quoting all instances of the variable that were not within double quotes. |
Would you mind contributing fix via PR (if @robinbowes doesn't object as he already started the #417)? «quoting all instances of the variable that were not within double quotes» — this is the way to go if you go with PR. Thanks PS: #714 (comment) |
Sure if the existing PR does not get updated by @robinbowes I can probably submit a PR tomorrow. |
#714 updated. |
This issue has been resolved in version 1.94.2 🎉 |
Describe the bug
Terraform hook fails when the terraform binary's path contains a space.
How can we reproduce it?
Do you have long logs to share? Please use collapsible sections, that can be created via:
LOGS
$ ${PWD}/path/to/terraform -v Terraform v1.9.3 on linux_amd64 + provider registry.terraform.io/hashicorp/null v3.2.2
Environment information
Bug is present on both Windows and Linux (initially discovered on Windows due to "Program Files" in path).
uname -a
and/orsysteminfo | Select-String "^OS"
output:Linux iac-dev-box-user1 6.5.0-1025-azure #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
.pre-commit-config.yaml
:file content
The text was updated successfully, but these errors were encountered: