Skip to content

Commit c8ed458

Browse files
authored
Merge pull request #5 from rhythmictech/cleanup
update semver ref and checks
2 parents b62082d + 477f0ab commit c8ed458

18 files changed

+529
-2
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @rhythmictech/engineering

.github/workflows/misspell.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: misspell
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
misspell:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: misspell
17+
uses: reviewdog/action-misspell@v1
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
locale: "US"
21+
reporter: github-check
22+
filter_mode: nofilter
23+
level: error

.github/workflows/pre-commit.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: pre-commit-check
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- prod
8+
- develop
9+
10+
jobs:
11+
pre-commit-check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
- name: Install prerequisites
18+
run: ./bin/install-ubuntu.sh
19+
- name: initialize Terraform
20+
run: terraform init --backend=false
21+
- name: pre-commit
22+
uses: pre-commit/[email protected]
23+
env:
24+
AWS_DEFAULT_REGION: us-east-1
25+
# many of these are covered by better reviewdog linters below
26+
SKIP: >-
27+
terraform_tflint_deep,
28+
no-commit-to-branch,
29+
terraform_tflint_nocreds,
30+
terraform_tfsec

.github/workflows/pullRequest.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: pull request
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
# TODO: #22 add job using https://github.com/reviewdog/action-alex
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
- name: Install prerequisites
15+
run: ./bin/install-ubuntu.sh
16+
- name: initialize Terraform
17+
run: terraform init --backend=false
18+
- name: pre-commit
19+
uses: pre-commit/[email protected]
20+
env:
21+
AWS_DEFAULT_REGION: us-east-1
22+
# many of these are covered by better reviewdog linters below
23+
SKIP: >-
24+
terraform_tflint_deep,
25+
no-commit-to-branch,
26+
terraform_tflint_nocreds,
27+
terraform_tfsec
28+
tflint:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
- name: Install prerequisites
33+
run: ./bin/install-ubuntu.sh
34+
- name: Terraform init
35+
run: terraform init --backend=false
36+
- name: tflint
37+
uses: reviewdog/action-tflint@master
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
reporter: github-pr-check
41+
filter_mode: added
42+
flags: --module
43+
level: error
44+
tfsec:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- name: Install prerequisites
49+
run: ./bin/install-ubuntu.sh
50+
- name: Terraform init
51+
run: terraform init --backend=false
52+
- name: tfsec
53+
uses: reviewdog/action-tfsec@master
54+
with:
55+
github_token: ${{ secrets.GITHUB_TOKEN }}
56+
reporter: github-pr-check
57+
filter_mode: added
58+
level: warning
59+
misspell:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v2
63+
- name: misspell
64+
uses: reviewdog/action-misspell@v1
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
locale: "US"
68+
reporter: github-pr-check
69+
filter_mode: added
70+
level: error
71+
yamllint:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v2
75+
- name: yamllint
76+
uses: reviewdog/action-yamllint@v1
77+
with:
78+
github_token: ${{ secrets.GITHUB_TOKEN }}
79+
reporter: github-pr-check
80+
filter_mode: added
81+
level: error

.github/workflows/tflint.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: tflint
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
tflint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install prerequisites
17+
run: ./bin/install-ubuntu.sh
18+
- name: Terraform init
19+
run: terraform init --backend=false
20+
- name: tflint
21+
uses: reviewdog/action-tflint@master
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
reporter: github-check
25+
filter_mode: nofilter
26+
flags: --module
27+
level: error

.github/workflows/tfsec.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: tfsec
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
tfsec:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install prerequisites
17+
run: ./bin/install-ubuntu.sh
18+
- name: Terraform init
19+
run: terraform init --backend=false
20+
- name: tfsec
21+
uses: reviewdog/action-tfsec@master
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
reporter: github-check
25+
filter_mode: nofilter
26+
level: error

.github/workflows/yamllint.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: yamllint
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
yamllint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: yamllint
17+
uses: reviewdog/action-yamllint@v1
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
reporter: github-check
21+
filter_mode: nofilter
22+
level: error

.pre-commit-config.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
exclude: ".terraform"
2+
repos:
3+
- repo: https://github.com/antonbabenko/pre-commit-terraform
4+
rev: v1.72.1
5+
hooks:
6+
- id: terraform_docs
7+
always_run: true
8+
- id: terraform_fmt
9+
- id: terraform_tflint
10+
alias: terraform_tflint_nocreds
11+
name: terraform_tflint_nocreds
12+
- id: terraform_tfsec
13+
- repo: local
14+
hooks:
15+
- id: terraform_validate
16+
name: terraform_validate
17+
entry: |
18+
bash -c '
19+
AWS_DEFAULT_REGION=us-east-1
20+
declare -a DIRS
21+
for FILE in "$@"
22+
do
23+
DIRS+=($(dirname "$FILE"))
24+
done
25+
for DIR in $(printf "%s\n" "${DIRS[@]}" | sort -u)
26+
do
27+
cd $(dirname "$FILE")
28+
terraform init --backend=false
29+
terraform validate .
30+
cd ..
31+
done
32+
'
33+
language: system
34+
verbose: true
35+
files: \.tf(vars)?$
36+
exclude: examples
37+
- id: tflock
38+
name: provider_locks
39+
entry: |
40+
bash -c '
41+
AWS_DEFAULT_REGION=us-east-1
42+
declare -a DIRS
43+
for FILE in "$@"
44+
do
45+
DIRS+=($(dirname "$FILE"))
46+
done
47+
for DIR in $(printf "%s\n" "${DIRS[@]}" | sort -u)
48+
do
49+
cd $(dirname "$FILE")
50+
terraform providers lock -platform=windows_amd64 -platform=darwin_amd64 -platform=linux_amd64
51+
cd ..
52+
done
53+
'
54+
language: system
55+
verbose: true
56+
files: \.tf(vars)?$
57+
exclude: examples
58+
- repo: https://github.com/pre-commit/pre-commit-hooks
59+
rev: v4.2.0
60+
hooks:
61+
- id: check-case-conflict
62+
- id: check-json
63+
- id: check-merge-conflict
64+
- id: check-symlinks
65+
- id: check-yaml
66+
args:
67+
- --unsafe
68+
- id: end-of-file-fixer
69+
- id: mixed-line-ending
70+
args:
71+
- --fix=lf
72+
- id: no-commit-to-branch
73+
args:
74+
- --branch
75+
- main
76+
- --branch
77+
- master
78+
- --branch
79+
- prod
80+
- id: pretty-format-json
81+
args:
82+
- --autofix
83+
- --top-keys=name,Name
84+
- id: trailing-whitespace
85+
args:
86+
- --markdown-linebreak-ext=md
87+
exclude: README.md
88+
ci:
89+
skip: [terraform_docs, terraform_fmt, terraform_tflint, terraform_tfsec, tflock]

.terraform-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.1.5

.tflint.hcl

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
config {
2+
module = true
3+
}
4+
5+
rule "terraform_deprecated_interpolation" {
6+
enabled = true
7+
}
8+
9+
rule "terraform_unused_declarations" {
10+
enabled = true
11+
}
12+
13+
rule "terraform_comment_syntax" {
14+
enabled = true
15+
}
16+
17+
rule "terraform_documented_outputs" {
18+
enabled = true
19+
}
20+
21+
rule "terraform_documented_variables" {
22+
enabled = true
23+
}
24+
25+
rule "terraform_typed_variables" {
26+
enabled = true
27+
}
28+
29+
rule "terraform_module_pinned_source" {
30+
enabled = true
31+
}
32+
33+
rule "terraform_naming_convention" {
34+
enabled = true
35+
format = "snake_case"
36+
}
37+
38+
rule "terraform_required_version" {
39+
enabled = false
40+
}
41+
42+
rule "terraform_required_providers" {
43+
enabled = true
44+
}

0 commit comments

Comments
 (0)