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(terraform_providers_lock): Require terraform init (and terraform_validate hook) run when only lockfile changed #649

Merged
merged 2 commits into from Mar 22, 2024

Conversation

MaxymVlasov
Copy link
Collaborator

@MaxymVlasov MaxymVlasov commented Mar 22, 2024

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

image

When the terraform root module contains any child module it requires terraform init to run to be able to successfully run the provider lock operation.

Previously, terraform init was in terraform_providers_lock hook too, but moved out to be only in terraform_validate, because there was little sense to try to lock anything that was code invalid.
If we return terraform init back to terraform_providers_lock - major changes in providers that remove resources etc. can be successfully written to lockfile without any checks, as such checks done in terraform_validate

Workaround till the release of that stuff

Add files: (\.tf|\.tfvars|\.terraform\.lock\.hcl)$ to terraform_validate hook call

@MaxymVlasov MaxymVlasov added bug_with_workaround Something isn't working but there is a workaround estimate/1h Need 1 hour to be done hook/terraform_validate Bash hook hook/terragrunt_providers_lock Bash hook labels Mar 22, 2024
@MaxymVlasov MaxymVlasov marked this pull request as ready for review March 22, 2024 13:29
.pre-commit-hooks.yaml Outdated Show resolved Hide resolved
Co-authored-by: George L. Yermulnik <yz@yz.kiev.ua>
@MaxymVlasov MaxymVlasov changed the title fix(terraform_providers_lock): Require t init (and terraform_validate) run when only lockfile changed fix(terraform_providers_lock): Require terraform init (and terraform_validate hook) run when only lockfile changed Mar 22, 2024
@MaxymVlasov MaxymVlasov merged commit 02c1935 into master Mar 22, 2024
7 checks passed
@MaxymVlasov MaxymVlasov deleted the fix/lockfile_change_validation branch March 22, 2024 13:34
antonbabenko pushed a commit that referenced this pull request Mar 22, 2024
## [1.88.3](v1.88.2...v1.88.3) (2024-03-22)

### Bug Fixes

* **`terraform_providers_lock`:** Require `terraform init` (and `terraform_validate` hook) run when only lockfile changed ([#649](#649)) ([02c1935](02c1935))
@antonbabenko
Copy link
Owner

This PR is included in version 1.88.3 🎉

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

Successfully merging this pull request may close these issues.

None yet

3 participants