Comments (3)
To add to this, I've just tried running terraform init -upgrade
locally to resolve this (and added back the other tests) and it all worked fine locally
Terraform fmt............................................................Passed
Terraform validate.......................................................Passed
Lock terraform provider versions.........................................Passed
Terraform validate with tflint...........................................Passed
Terraform validate with trivy............................................Passed
terrascan................................................................Passed
tfupdate.................................................................Passed
Terraform docs...........................................................Passed
However pushing to CICD shows the following
[INFO] Initializing environment for https://github.com/antonbabenko/pre-commit-terraform.
Terraform fmt............................................................Passed
Terraform validate.......................................................Failed
- hook id: terraform_validate
- files were modified by this hook
Command 'terraform init' successfully done: .
Lock terraform provider versions.........................................Passed
Terraform validate with tflint...........................................Passed
Terraform validate with trivy............................................Passed
terrascan................................................................Passed
tfupdate.................................................................Passed
Terraform docs...........................................................Passed
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl
index 1d61275..38a779c 100644
--- a/.terraform.lock.hcl
+++ b/.terraform.lock.hcl
@@ -6,6 +6,7 @@ provider "registry.terraform.io/hashicorp/azurerm" {
constraints = "3.108.0"
hashes = [
"h1:36WHCMjguUKG15iS3WNqmk2/FQH2AwFL0mJl0VWCfps=",
+ "h1:RIFBFTXz4X48JDHjbQHX4y400ax1/uEzMVFZgX3/z3w=",
"zh:2afecf948fd702bc08c87d9114595809d011f99a70a12dbf6bc67a12d0bee5fc",
"zh:395b6d1384a579867064e62d49b0b91e15919c33b03ea8b5031c2779bfa16b3d",
"zh:3e5594c59b6b02bc6e0f4c3de71aa2ab992494c53725fb3c64d36745f3814ef3",
@@ -26,6 +27,7 @@ provider "registry.terraform.io/hashicorp/null" {
constraints = "3.2.2"
hashes = [
"h1:IMVAUHKoydFrlPrl9OzasDnw/8ntZFerCC9iXw1rXQY=",
+ "h1:zT1ZbegaAYHwQa+QwIFugArWikRJI9dqohj8xb0GY88=",
"zh:3248aae6a2198f3ec8394218d05bd5e42be59f43a3a7c0b71c66ec0df08b69e7",
"zh:32b1aaa1c3013d33c245493f4a65465eab9436b454d250102729321a44c8ab9a",
"zh:38eff7e470acb48f66380a73a5c7cdd76cc9b9c9ba9a7249c7991488abe22fe3",
Error: Process completed with exit code 1.
I'm now thinking this is due to me creating the lockfile locally on a macbook and then running the tests in the linux container. Will try to confirm and close if so.
from pre-commit-terraform.
Yeah, apologies, worked it out, will close issue
Adding the following to .pre-commit-config.yaml
fixed the issue
- id: terraform_providers_lock
args:
- --hook-config=--mode=always-regenerate-lockfile
- --args=-platform=linux_amd64
- --args=-platform=darwin_arm64
from pre-commit-terraform.
I'm now thinking this is due to me creating the lockfile locally on a macbook and then running the tests in the linux container.
Yep, it is.
from pre-commit-terraform.
Related Issues (20)
- Add `terragrunt_providers_lock` hook HOT 11
- terraform_checkov hook fails in Docker container since version v1.83.5 HOT 5
- Checkov install silently fails during image build (and is also missing when pulling from ghcr.io) HOT 4
- Bash environment variable expansion not working for trivy HOT 26
- Provide non-root docker build HOT 4
- terraform validate: Force rerun `t init` when plugin cache is enabled and parrallelism conflit happens HOT 8
- Ability to use terraform_plan framework of checkov HOT 8
- [trivy/pre-commit] Terraform trivy configuration excludes .trivyignore files, forcing repetitive ignore statements HOT 7
- Windows Support / Rewrite hooks to Python HOT 11
- Quotation Marks in Environment Variables HOT 2
- Get docker image running in github action HOT 10
- [tf aws provider version] terraform_validate false negative on `aws_kinesis_firehose_delivery_stream.extended_s3_configuration.file_extension` HOT 3
- Add PATH to terraform_docs HOT 7
- [terraform outdated provider] New Data Source: aws_ecr_lifecycle_policy_document HOT 4
- Remove Political Banners from Repo
- [`trivy:ignore:` usage] Terraform Security Check AVD-AWS-0342 HOT 9
- Terragrunt validate-inputs hook? HOT 7
- Intermittently "no such file or directory" error seen when using trivy pre-commit hook HOT 9
- [misspell in `--hook-config` option] terraform_docs hook fails to detect out-of-date document HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pre-commit-terraform.