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_fmt.sh doesn't respect excludes #121

Closed
ericfrederich opened this issue Jun 30, 2020 · 3 comments
Closed

terraform_fmt.sh doesn't respect excludes #121

ericfrederich opened this issue Jun 30, 2020 · 3 comments
Assignees
Labels
estimate/4h Need 4 hours to be done feature New feature or request hook/terraform_fmt Bash hook

Comments

@ericfrederich
Copy link

pre-commit has the ability to exclude files either globally or per hook.

The terraform_fmt.sh accepts a list of files to format. However, it ends up simply running terraform fmt on the dirname of all the files. This means if a file which is explicitly excluded in the .pre-commit-config.yaml file is sitting in the same directory as a file which is not excluded, it'll end up getting formatted.

The terraform_fmt.sh script should stop trying to be clever and simply run terraform fmt against the files explicitly handed to it and nothing more.

ericfrederich added a commit to ericfrederich/pre-commit-terraform that referenced this issue Jun 30, 2020
ericfrederich added a commit to ericfrederich/pre-commit-terraform that referenced this issue Jun 30, 2020
ericfrederich added a commit to ericfrederich/pre-commit-terraform that referenced this issue Jun 30, 2020
@ericfrederich
Copy link
Author

Can someone review this?

@github-actions
Copy link

github-actions bot commented Oct 5, 2021

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 5, 2021
@antonbabenko antonbabenko removed the stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 5, 2021
@MaxymVlasov
Copy link
Collaborator

Works fine with the latest version

repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
  rev: v1.62.3
  hooks:
  - id: terraform_fmt
    exclude: environment\/.*$

\.terraform\/.*$ excluded globally from Aug 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimate/4h Need 4 hours to be done feature New feature or request hook/terraform_fmt Bash hook
Projects
None yet
3 participants