Reputation: 203
I'm using pre-commit to validate my terraform projects. My default configs for most of project as below:
cat <<EOF > .pre-commit-config.yaml
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.64.0
hooks:
- id: terraform_tflint
args:
- --args=--var-file=dev.tfvars
- --args=--var-file=uat.tfvars
- --args=--var-file=prod.tfvars
I rollout this config for all envs. It's working well now. But I have few projects which don't need to have tfvars file for 3 envs. Ex: They only need 1 tfvars in dev. I will get the error with pre-commit.
So I want to input args as variable when I run pre-commit command. Anyone has a solution for this case
Upvotes: 0
Views: 1278
Reputation: 69964
there is intentionally no such option -- pre-commit
will only run the configured commands and arguments such that if it is configured in a repository it will be the same for any user with that repository and configuration. repository-specific configuration (.pre-commit-config.yaml
) is not intended to be shared across repositories (there is intentionally no mechanism to do so)
you should use the specific arguments in the specific repository's configuration which needs them
disclaimer: I created pre-commit
Upvotes: 1