gruntwork-io / pre-commit

A collection of pre-commit hooks used by Gruntwork tools
https://gruntwork.io/
Apache License 2.0
484 stars 155 forks source link

add option to customize flags to terraform init for terraform validate #73

Open scbunn opened 2 years ago

scbunn commented 2 years ago

Describe the solution you'd like The terraform lock file is causing issues with terraform validate being run in an automated job. Terraform init is updating the hashes in the lockfile and thus failing the job because it detects changes were made to files.

For now this can be fixed by not checking in the lock file but this is outside of what hashicorp is recommending.

wolfm89 commented 2 years ago

@scbunn This is a very late answer but I faced the same problems. What helped me fix it was running

terraform providers lock -platform=linux_amd64 -platform=windows_amd64

This adds all hashes for these two platforms to the lock file. It's also describe at the end of the section https://www.terraform.io/language/files/dependency-lock#new-provider-package-checksums