gruntwork-io / gruntwork-io/pre-commit

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

Open
#106 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Shell
Stars
547
Forks
168
PR merge metrics
No merged PRs in 30d

Description

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

```yaml
repos:
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.23
hooks:
- id: terraform-validate
args: [-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:

```shell
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:

```shell
terraform -chdir=whatever validate
```

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.