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

fix: Extend terraform_validate --retry-once-with-cleanup errors list #566

Merged
merged 2 commits into from Sep 4, 2023

Conversation

MaxymVlasov
Copy link
Collaborator

Put an x into the box if that apply:

  • This PR introduces breaking change.
  • This PR fixes a bug.
  • This PR adds new functionality.
  • This PR enhances existing functionality.

Description of your changes

Fixes #561

How can we test changes

To reproduce:

gh repo clone osinfra-io/google-cloud-networking
cd google-cloud-networking
pre-commit run -a
rm -rf global/infra/.terraform/providers/registry.terraform.io/hashicorp/google/4.80.0 
pre-commit run -a

Test fix:

  1. change in .pre-commit-config.yaml

from

  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: v1.83.0

to

  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: 043a10b51662786ef59ecba95d76984a21fd0d20

run

pre-commit run -a

@@ -100,6 +101,7 @@ function per_dir_hook_unique_part {

case $key in
--retry-once-with-cleanup)
# shellcheck disable=SC2086 # It's just works. Maybe will be fixed later
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# shellcheck disable=SC2086 # It's just works. Maybe will be fixed later
# shellcheck disable=SC2086 # It just works. Maybe will be fixed later

JFYI: it should work the same way if the var is wrapped into double quotes (if [ "$retry_once_with_cleanup" ]; then), though as suggested by shellcheck is a way much more secure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, okay. Let's then add quotes, and hope that it will not break anything (once I'll wrote tests, but not today)

@MaxymVlasov MaxymVlasov changed the title fix: Extend --retry-once-with-cleanup terraform_validate errors list fix: Extend terraform_validate --retry-once-with-cleanup errors list Sep 4, 2023
@MaxymVlasov MaxymVlasov merged commit 19188e5 into master Sep 4, 2023
6 checks passed
@MaxymVlasov MaxymVlasov deleted the fix/GH-561 branch September 4, 2023 13:58
antonbabenko pushed a commit that referenced this pull request Sep 4, 2023
## [1.83.2](v1.83.1...v1.83.2) (2023-09-04)

### Bug Fixes

* Extend `terraform_validate` `--retry-once-with-cleanup` errors list ([#566](#566)) ([19188e5](19188e5))
@antonbabenko
Copy link
Owner

This PR is included in version 1.83.2 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working estimate/1h Need 1 hour to be done hook/terraform_validate Bash hook
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform validate --retry-once-with-cleanup=true not cleaning up all .terraform/providers issues
3 participants