-
Notifications
You must be signed in to change notification settings - Fork 17
/
.pre-commit-config.yaml
69 lines (69 loc) · 1.76 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.0
hooks:
- id: terraform_docs
always_run: true
- id: terraform_fmt
- id: terraform_tflint
alias: terraform_tflint_deep
name: terraform_tflint_deep
args:
- --args=--deep
- id: terraform_tflint
alias: terraform_tflint_nocreds
name: terraform_tflint_nocreds
- id: terraform_tfsec
- repo: local
hooks:
- id: terraform_validate
name: terraform_validate
entry: |
bash -c '
AWS_DEFAULT_REGION=us-east-1
declare -a DIRS
for FILE in "$@"
do
DIRS+=($(dirname "$FILE"))
done
for DIR in $(printf "%s\n" "${DIRS[@]}" | sort -u)
do
cd $(dirname "$FILE")
terraform init --backend=false
terraform validate .
done
'
language: system
verbose: true
files: \.tf(vars)?$
exclude: examples
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.0.0
hooks:
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
args:
- --unsafe
- id: end-of-file-fixer
- id: mixed-line-ending
args:
- --fix=lf
- id: no-commit-to-branch
args:
- --branch
- main
- --branch
- master
- --branch
- prod
- id: pretty-format-json
args:
- --autofix
- --top-keys=name,Name
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md
exclude: README.md