-
-
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
fix: Support custom TF paths which contains spaces #714
Conversation
@robinbowes Thanks for the contribution. It looks like we'd better quote all instances of > sift -n '[^"]\$tf_path'
hooks/terraform_validate.sh:121: $tf_path validate "${args[@]}" &> /dev/null && {
hooks/terraform_validate.sh:135: validate_output=$($tf_path validate "${args[@]}" 2>&1)
hooks/terraform_validate.sh:139: validate_output=$($tf_path validate -json "${args[@]}" 2>&1)
hooks/terraform_validate.sh:162: validate_output=$($tf_path validate "${args[@]}" 2>&1)
hooks/terraform_providers_lock.sh:158: $tf_path providers lock "${args[@]}"
hooks/_common.sh:539: init_output=$($tf_path init -backend=false "${TF_INIT_ARGS[@]}" 2>&1)
hooks/_common.sh:545: init_output=$($tf_path init -backend=false "${TF_INIT_ARGS[@]}" 2>&1)
hooks/terraform_fmt.sh:52: $tf_path fmt "${args[@]}" |
Heh, I fixed all the occurrences you listed before I saw your comment. I made one additional change in terraform_providers_lock.sh to use $tf_path instead of the text "terraform" to match the style used in other files. Should be good to go now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Let's wait for @MaxymVlasov to take a look into this change so that we don't miss something non-obvious
terraform_fmt
): Support custom TF paths which contains spaces
terraform_fmt
): Support custom TF paths which contains spaces## [1.94.2](v1.94.1...v1.94.2) (2024-09-09) ### Bug Fixes * Support custom TF paths which contains spaces ([#714](#714)) ([2bca410](2bca410))
This PR is included in version 1.94.2 🎉 |
This caused a breaking change, FYI. My CI job calls I found that terraform was not installed on the CI environment. Before 1.94.2, the pre-commit job would pass anyway. Now it fails for terraform being missing. It did expose that terraform wasn't actually installed, so it was helpful in that way. But I wanted to call out the breaking change. |
|
To be clear, I’m glad this change was made. When terraform was not installed, it was not actually doing any checks or doing any formatting. It succeeded silently. I’m mentioning it because when it started failing with no changes of my own, I looked at the changelog and nothing looked related. I went version by version to find that it was this that changed it. minimal steps to reproduce:
Before this commit, it would pass, and make no formatting changes. After this commit, it fails, and says terraform is not installed. (Which is probably the better behavior) |
Put an
x
into the box if that apply:Description of your changes
Add quotes around variable containing path to terraform so it works when the path contains a space.
Fixes #713
How can we test changes