Skip to content

Ability to use -chdir=DIR with tf validate and tf fmt #106

Description

@lexicalunit

Describe the solution you'd like
I need to be able to set the dir via the global terraform argument -chdir=... before running validate:

repos:
- repo: https://github.com/gruntwork-io/pre-commitrev: v0.1.23hooks:
- id: terraform-validateargs: [-chdir=whatever]

However, what the above configuration actually does is attempt to pass -chidr=whatever to the validate subcommand. In other words, it executes this:

terraform validate -chdir=whatever

But that's an error because -chdir is not a valid argument for terraform validate.

What I need is a way to execute this:

terraform -chdir=whatever validate

Describe alternatives you've considered
I haven't found a way to set the working directory via some other means.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions