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

feat: Speedup terraform_validate - firstly try run validate without checking is .terraform/ is valid #524

Merged
merged 3 commits into from
Jun 12, 2023

Conversation

smelchior
Copy link
Contributor

@smelchior smelchior commented May 15, 2023

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

As discussed in #509 (comment) i would like to introduce a change to run terraform validate in the hook first without running the checks if terraform init is needed.
This helps in situations where there is no .terraform/modules or .terraform/providers directory as terraform init would be called every time.

How can we test changes

Run the terraform_validate.sh hook against your test repositories, if terraform validate should run first without any additional checks. If it fails, the normal workflow continues.

MaxymVlasov

This comment was marked as off-topic.

@smelchior
Copy link
Contributor Author

Is there anything i can to to help get this merged :)?

@MaxymVlasov
Copy link
Collaborator

@yermulnik please review

@MaxymVlasov MaxymVlasov changed the title fix: Terraform validate - run first validate without running terraform init feat: Speedup terraform_validate - firstly try run validate without checking is .terraform/ is valid Jun 12, 2023
@MaxymVlasov MaxymVlasov merged commit d0d08ac into antonbabenko:master Jun 12, 2023
@MaxymVlasov MaxymVlasov added feature New feature or request hook/terraform_validate Bash hook labels Jun 12, 2023
@MaxymVlasov
Copy link
Collaborator

@smelchior Sorry for delay

antonbabenko pushed a commit that referenced this pull request Jun 12, 2023
# [1.81.0](v1.80.0...v1.81.0) (2023-06-12)

### Features

* Speedup `terraform_validate` - firstly try run validate without checking is `.terraform/` is valid ([#524](#524)) ([d0d08ac](d0d08ac))
@antonbabenko
Copy link
Owner

This PR is included in version 1.81.0 🎉

@smelchior
Copy link
Contributor Author

Thanks for merging this! That makes my life a lot easier :)!

@smelchior smelchior deleted the fix/validate branch June 12, 2023 18:51
@bryantbiggs
Copy link

is this supposed to output an error? When I run pre-commit now, it looks like theres an error but then it says it was able to init successfully even on repeat back-to-back executions

image

@antonbabenko
Copy link
Owner

@bryantbiggs I think it is expected behavior since there are recoverable errors. After it runs, there should be no errors and it should "pass".

@bryantbiggs
Copy link

yes I'm seeing that now as well - I guess its just when it finds errors that need to be fixed that it shows that output but once all pre-commit checks are passing they are gone and its green. thanks, sorry for the noise!
image

@MaxymVlasov
Copy link
Collaborator

We can add >/dev/null for that, lmc check is that fix issue

@MaxymVlasov
Copy link
Collaborator

MaxymVlasov commented Jul 14, 2023

I can't reproduce. In any case, open a issue in case you'll need anything

Repository owner locked as resolved and limited conversation to collaborators Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or request hook/terraform_validate Bash hook
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants