kintoandar / pre-commit Goto Github PK
View Code? Open in Web Editor NEWpre-commit hook terraform; pre-commit hook prometheus
Home Page: http://pre-commit.com/
License: MIT License
pre-commit hook terraform; pre-commit hook prometheus
Home Page: http://pre-commit.com/
License: MIT License
I am running this pre-commit hook on terraform 0.9.11 but doesn't seem to quite do the job for terraform_validate
Reads the Terraform files in the given path (directory) and
validates their syntax and basic semantics.
This is not a full validation that is normally done with
a plan or apply operation, but can be used to verify the basic
syntax and usage of Terraform configurations is correct.
Options:
-no-color If specified, output won't contain any color.```
Configuration A:
- repo: https://github.com/kintoandar/pre-commit
rev: v2.1.2
hooks:
- id: terraform_validate
Steps to reproduce:
pre-commit run terraform_validate --all-files
Expected:
terraform_validate
should pass successfully
Actual:
terraform_validate
fails with the following error:
terraform_validate.......................................................Failed
- hook id: terraform_validate
- exit code: 1
Usage: terraform validate [options] [dir]
Validate the configuration files in a directory, referring only to the
configuration and not accessing any remote services such as remote state,
provider APIs, etc.
Validate runs checks that verify whether a configuration is syntactically
valid and internally consistent, regardless of any provided variables or
existing state. It is thus primarily useful for general verification of
reusable modules, including correctness of attribute names and value types.
It is safe to run this command automatically, for example as a post-save
check in a text editor or as a test step for a re-usable module in a CI
system.
Validation requires an initialized working directory with any referenced
plugins and modules installed. To initialize a working directory for
validation without accessing any configured remote backend, use:
terraform init -backend=false
If dir is not specified, then the current directory will be used.
To verify configuration in the context of a particular run (a particular
target workspace, input variable values, etc), use the 'terraform plan'
command instead, which includes an implied validation check.
Options:
-json Produce output in a machine-readable JSON format, suitable for
use in text editor integrations and other automated systems.
Always disables color.
-no-color If specified, output won't contain any color.
Error parsing command-line flags: flag provided but not defined: -check-variables
I'm looking at the How-To and in Step 2, the example is this:
cat <<EOF > .pre-commit-config.yaml
- repo: git://github.com/kintoandar/pre-commit.git
sha: v2.1.2
hooks:
- id: terraform_fmt
- id: terraform_validate
- id: prometheus_check_rules
- id: prometheus_check_config
EOF
Shouldn't sha
be rev
like other hooks?
Thanks
Configuration A:
- repo: https://github.com/kintoandar/pre-commit
rev: v2.1.2
hooks:
- id: terraform_validate
Steps to reproduce:
pre-commit run terraform_validate --all-files
Expected:
terraform_validate
should pass successfully
Actual:
terraform_validate
fails with the following error:
terraform_validate.......................................................Failed
- hook id: terraform_validate
- exit code: 1
Usage: terraform validate [options] [dir]
Validate the configuration files in a directory, referring only to the
configuration and not accessing any remote services such as remote state,
provider APIs, etc.
Validate runs checks that verify whether a configuration is syntactically
valid and internally consistent, regardless of any provided variables or
existing state. It is thus primarily useful for general verification of
reusable modules, including correctness of attribute names and value types.
It is safe to run this command automatically, for example as a post-save
check in a text editor or as a test step for a re-usable module in a CI
system.
Validation requires an initialized working directory with any referenced
plugins and modules installed. To initialize a working directory for
validation without accessing any configured remote backend, use:
terraform init -backend=false
If dir is not specified, then the current directory will be used.
To verify configuration in the context of a particular run (a particular
target workspace, input variable values, etc), use the 'terraform plan'
command instead, which includes an implied validation check.
Options:
-json Produce output in a machine-readable JSON format, suitable for
use in text editor integrations and other automated systems.
Always disables color.
-no-color If specified, output won't contain any color.
Error parsing command-line flags: flag provided but not defined: -check-variables
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.