Skip to content

Commit 7a885e2

Browse files
authored
Align (#4)
* update to align with other rds modules
1 parent 30221de commit 7a885e2

28 files changed

+791
-237
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-check.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/pre-commit.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: pre-commit-check
3+
on:
4+
push:
5+
branches: -- main
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: Setup Terraform
20+
uses: hashicorp/setup-terraform@v1
21+
with:
22+
terraform_version: ~> 0.12.29
23+
- name: initialize Terraform
24+
run: terraform init --backend=false
25+
- name: pre-commit
26+
uses: pre-commit/[email protected]
27+
env:
28+
AWS_DEFAULT_REGION: us-east-1
29+
# many of these are covered by better reviewdog linters below
30+
SKIP: >-
31+
terraform_tflint_deep,
32+
no-commit-to-branch,
33+
terraform_tflint_nocreds,
34+
terraform_tfsec
35+
- uses: stefanzweifel/git-auto-commit-action@v4
36+
if: ${{ failure() }}
37+
with:
38+
commit_message: Apply automatic changes
39+
commit_options: "--no-verify"
40+
# Optional commit user and author settings
41+
commit_user_name: Linter Bot
42+
commit_user_email: [email protected]
43+
commit_author: Linter Bot <[email protected]>

.github/workflows/pullRequest.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
name: pull request
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
pre-commit:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Python
12+
uses: actions/setup-python@v2
13+
- name: Install prerequisites
14+
run: ./bin/install-ubuntu.sh
15+
- name: Setup Terraform
16+
uses: hashicorp/setup-terraform@v1
17+
with:
18+
terraform_version: ~> 0.12.29
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
31+
- uses: stefanzweifel/git-auto-commit-action@v4
32+
if: ${{ failure() }}
33+
with:
34+
commit_message: Apply automatic changes
35+
commit_options: "--no-verify"
36+
# Optional commit user and author settings
37+
commit_user_name: Linter Bot
38+
commit_user_email: [email protected]
39+
commit_author: Linter Bot <[email protected]>
40+
tflint:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v2
44+
- name: setup Terraform
45+
uses: hashicorp/setup-terraform@v1
46+
with:
47+
terraform_version: 0.12.26
48+
- name: Terraform init
49+
run: terraform init --backend=false
50+
- name: tflint
51+
uses: reviewdog/action-tflint@master
52+
with:
53+
github_token: ${{ secrets.GITHUB_TOKEN }}
54+
reporter: github-pr-check
55+
filter_mode: added
56+
flags: --module
57+
level: error
58+
tfsec:
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v2
62+
- name: setup Terraform
63+
uses: hashicorp/setup-terraform@v1
64+
with:
65+
terraform_version: 0.12.26
66+
- name: Terraform init
67+
run: terraform init --backend=false
68+
- name: tfsec
69+
uses: reviewdog/action-tfsec@master
70+
with:
71+
github_token: ${{ secrets.GITHUB_TOKEN }}
72+
reporter: github-pr-check
73+
filter_mode: added
74+
level: warning
75+
misspell:
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: actions/checkout@v2
79+
- name: misspell
80+
uses: reviewdog/action-misspell@v1
81+
with:
82+
github_token: ${{ secrets.GITHUB_TOKEN }}
83+
locale: "US"
84+
reporter: github-pr-check
85+
filter_mode: added
86+
level: error
87+
yamllint:
88+
runs-on: ubuntu-latest
89+
steps:
90+
- uses: actions/checkout@v2
91+
- name: yamllint
92+
uses: reviewdog/action-yamllint@v1
93+
with:
94+
github_token: ${{ secrets.GITHUB_TOKEN }}
95+
reporter: github-pr-check
96+
filter_mode: added
97+
level: error

.github/workflows/tflint.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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: setup Terraform
17+
uses: hashicorp/setup-terraform@v1
18+
with:
19+
terraform_version: 0.12.26
20+
- name: Terraform init
21+
run: terraform init --backend=false
22+
- name: tflint
23+
uses: reviewdog/action-tflint@master
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
reporter: github-check
27+
filter_mode: nofilter
28+
flags: --module
29+
level: error

.github/workflows/tfsec.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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: setup Terraform
17+
uses: hashicorp/setup-terraform@v1
18+
with:
19+
terraform_version: 0.12.26
20+
- name: Terraform init
21+
run: terraform init --backend=false
22+
- name: tfsec
23+
uses: reviewdog/action-tfsec@master
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
reporter: github-check
27+
filter_mode: nofilter
28+
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

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77

88
# .tfvars files
99
*.tfvars
10+
11+
.vscode

.pre-commit-config.yaml

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

0 commit comments

Comments
 (0)