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

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

Open
fabasoad opened this issue Apr 12, 2022 · 2 comments

Comments

@fabasoad
Copy link

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
@fabasoad
Copy link
Author

A few notes:

  • I have the following folder structure:
root/folder1/terraform.tfvars
     folder2/terraform.tfvars
     folder3/terraform.tfvars
  • I checked terraform validate command separately and it works (both from root and from each folderN).

@kintoandar
Copy link
Owner

Hey,

I haven't been using pre-commit for the last few years, and as such not actively maintaining these hooks, will probably archive this repo to avoid further confusion

Thank you for raising this 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants