Skip to content
This repository was archived by the owner on Jul 31, 2024. It is now read-only.

Commit b7b2171

Browse files
authored
Merge pull request #2 from cdaniluk/demo
Demo
2 parents cae9b34 + 5e62cc5 commit b7b2171

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1015
-175
lines changed

.github/workflows/misspell.yaml

+23
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.yml

-22
This file was deleted.

.github/workflows/pre-commit.yaml

+43
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

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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: Setup Terraform
17+
uses: hashicorp/setup-terraform@v1
18+
with:
19+
terraform_version: ~0.12.29
20+
- name: initialize Terraform
21+
run: terraform init --backend=false
22+
- name: pre-commit
23+
uses: pre-commit/[email protected]
24+
env:
25+
AWS_DEFAULT_REGION: us-east-1
26+
# many of these are covered by better reviewdog linters below
27+
SKIP: >-
28+
terraform_tflint_deep,
29+
no-commit-to-branch,
30+
terraform_tflint_nocreds,
31+
terraform_tfsec
32+
- uses: stefanzweifel/git-auto-commit-action@v4
33+
if: ${{ failure() }}
34+
with:
35+
commit_message: Apply automatic changes
36+
commit_options: "--no-verify"
37+
# Optional commit user and author settings
38+
commit_user_name: Linter Bot
39+
commit_user_email: [email protected]
40+
commit_author: Linter Bot <[email protected]>
41+
tflint:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v2
45+
- name: setup Terraform
46+
uses: hashicorp/setup-terraform@v1
47+
with:
48+
terraform_version: ~0.12.29
49+
- name: Terraform init
50+
run: terraform init --backend=false
51+
- name: tflint
52+
uses: reviewdog/action-tflint@master
53+
with:
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
reporter: github-pr-check
56+
filter_mode: added
57+
flags: --module
58+
level: error
59+
tfsec:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v2
63+
- name: setup Terraform
64+
uses: hashicorp/setup-terraform@v1
65+
with:
66+
terraform_version: ~0.12.29
67+
- name: Terraform init
68+
run: terraform init --backend=false
69+
- name: tfsec
70+
uses: reviewdog/action-tfsec@master
71+
with:
72+
github_token: ${{ secrets.GITHUB_TOKEN }}
73+
reporter: github-pr-check
74+
filter_mode: added
75+
level: warning
76+
misspell:
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v2
80+
- name: misspell
81+
uses: reviewdog/action-misspell@v1
82+
with:
83+
github_token: ${{ secrets.GITHUB_TOKEN }}
84+
locale: "US"
85+
reporter: github-pr-check
86+
filter_mode: added
87+
level: error
88+
yamllint:
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@v2
92+
- name: yamllint
93+
uses: reviewdog/action-yamllint@v1
94+
with:
95+
github_token: ${{ secrets.GITHUB_TOKEN }}
96+
reporter: github-pr-check
97+
filter_mode: added
98+
level: error

.github/workflows/tflint.yaml

+29
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.29
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

+28
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.29
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

+22
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

+3
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ override.tf.json
2828

2929
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
3030
# example: *tfplan*
31+
32+
*.zip
33+
**/builds

.pre-commit-config.yaml

+71-12
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.24.0
5-
hooks:
6-
- id: terraform_fmt
7-
- id: terraform_docs
8-
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v2.4.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

.terraform-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.24
1+
0.13.4

0 commit comments

Comments
 (0)