Giter VIP home page Giter VIP logo

pre-commit's People

Contributors

gabesmed avatar kintoandar avatar leventyalcin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pre-commit's Issues

`terraform_validate` fails with "Error parsing command-line flags: flag provided but not defined: -check-variables" error

Configuration A:

- repo: https://github.com/kintoandar/pre-commit
  rev: v2.1.2
  hooks:
    - id: terraform_validate

Steps to reproduce:

  1. Define configuration A
  2. Run 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

`terraform_validate` fails with "Error parsing command-line flags: flag provided but not defined: -check-variables

Configuration A:

- repo: https://github.com/kintoandar/pre-commit
  rev: v2.1.2
  hooks:
    - id: terraform_validate

Steps to reproduce:

  1. Define configuration A
  2. Run 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

Changes on terraform 0.9.11

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.```

How-To Example Incorrect?

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.