Skip to content

Commit d772bb5

Browse files
authored
Merge pull request #14 from dasmeta/best-practice
fix(best-practices): add all best practices
2 parents 3a0e2ae + 9cc381c commit d772bb5

File tree

12 files changed

+289
-0
lines changed

12 files changed

+289
-0
lines changed

.github/workflows/checkov.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Checkov
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main, master]
6+
jobs:
7+
terraform-validate:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
actions: write
11+
contents: write
12+
discussions: write
13+
pull-requests: write
14+
security-events: write
15+
id-token: write
16+
strategy:
17+
matrix:
18+
path:
19+
- /
20+
21+
steps:
22+
- uses: dasmeta/reusable-actions-workflows/checkov@main
23+
with:
24+
fetch-depth: 0
25+
directory: ${{ matrix.path }}
26+
continue-on-error: true

.github/workflows/pre-commit.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Pre-Commit
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main, master]
6+
jobs:
7+
terraform-validate:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
actions: write
11+
contents: write
12+
discussions: write
13+
pull-requests: write
14+
id-token: write
15+
steps:
16+
- name: Pre-Commit
17+
uses: dasmeta/reusable-actions-workflows/pre-commit@main
18+
with:
19+
repo-token: ${{ secrets.GITHUB_TOKEN }}
20+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
21+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
22+
path: modules/${{ matrix.path }}
23+
continue-on-error: true

.github/workflows/semantic.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Semantic-Release
2+
on: [pull_request, push]
3+
jobs:
4+
publish:
5+
runs-on: ubuntu-latest
6+
permissions:
7+
actions: write
8+
contents: write
9+
discussions: write
10+
pull-requests: write
11+
id-token: write
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: 16
18+
- name: Semantic Release
19+
uses: cycjimmy/semantic-release-action@v3
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Terraform Test
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main, master]
6+
jobs:
7+
terraform-validate:
8+
permissions:
9+
actions: write
10+
contents: write
11+
discussions: write
12+
pull-requests: write
13+
id-token: write
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
path:
18+
- /
19+
20+
steps:
21+
- uses: dasmeta/reusable-actions-workflows/terraform-test@main
22+
with:
23+
aws-region: ${{ secrets.AWS_REGION}}
24+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
25+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
26+
path: ${{ matrix.path }}
27+
continue-on-error: true

.github/workflows/tflint.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Tflint
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main, master]
6+
7+
jobs:
8+
terraform-validate:
9+
permissions:
10+
actions: write
11+
contents: write
12+
discussions: write
13+
pull-requests: write
14+
id-token: write
15+
security-events: write
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
path:
20+
- /
21+
22+
steps:
23+
- uses: dasmeta/reusable-actions-workflows/tflint@main
24+
with:
25+
aws-region: ${{ secrets.AWS_REGION}}
26+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
27+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
28+
path: ${{ matrix.path }}
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
continue-on-error: true

.github/workflows/tfsec.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: TFSEC
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main, master]
6+
jobs:
7+
terraform-tfsec:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
actions: write
11+
contents: write
12+
discussions: write
13+
pull-requests: write
14+
id-token: write
15+
security-events: write
16+
steps:
17+
- uses: dasmeta/reusable-actions-workflows/tfsec@main
18+
with:
19+
fetch-depth: 0
20+
continue-on-error: true

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-merge-conflict
7+
- id: check-vcs-permalinks
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
10+
args: [--markdown-linebreak-ext=md]
11+
exclude: CHANGELOG.md
12+
- id: check-yaml
13+
- id: check-merge-conflict
14+
- id: check-case-conflict
15+
- id: mixed-line-ending
16+
args: [--fix=lf]
17+
- id: detect-aws-credentials
18+
args: ['--allow-missing-credentials']
19+
- id: detect-private-key
20+
- repo: https://github.com/antonbabenko/pre-commit-terraform
21+
rev: v1.64.1
22+
hooks:
23+
- id: terraform_fmt
24+
- id: terraform_docs
25+
args:
26+
- --hook-config=--path-to-file=README.md
27+
- --hook-config=--add-to-existing-file=true
28+
- --hook-config=--create-file-if-not-exist=true

commitlint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
extends: [
3+
"@commitlint/config-conventional"
4+
]
5+
}

git-conventional-commits.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"convention" : {
3+
"commitTypes": [
4+
"feat",
5+
"fix",
6+
"perf",
7+
"refactor",
8+
"style",
9+
"test",
10+
"build",
11+
"ops",
12+
"docs",
13+
"merge",
14+
"chore"
15+
],
16+
"commitScopes": [],
17+
"releaseTagGlobPattern": "v[0-9]*.[0-9]*.[0-9]*",
18+
"issueRegexPattern": "(^|\\s)#\\d+(\\s|$)"
19+
},
20+
"changelog" : {
21+
"commitTypes": [
22+
"feat",
23+
"fix",
24+
"perf",
25+
"merge"
26+
],
27+
"includeInvalidCommits": true,
28+
"commitScopes": [],
29+
"commitIgnoreRegexPattern": "^WIP ",
30+
"headlines": {
31+
"feat": "Features",
32+
"fix": "Bug Fixes",
33+
"perf": "Performance Improvements",
34+
"merge": "Merged Branches",
35+
"breakingChange": "BREAKING CHANGES"
36+
},
37+
"commitUrl": "https://github.com/ACCOUNT/REPOSITORY/commit/%commit%",
38+
"commitRangeUrl": "https://github.com/ACCOUNT/REPOSITORY/compare/%from%...%to%?diff=split",
39+
"issueUrl": "https://github.com/ACCOUNT/REPOSITORY/issues/%issue%"
40+
}
41+
}

githooks/commit-msg

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"convention" : {
3+
"commitTypes": [
4+
"feat",
5+
"fix",
6+
"perf",
7+
"refactor",
8+
"style",
9+
"test",
10+
"build",
11+
"ops",
12+
"docs",
13+
"merge",
14+
"chore"
15+
],
16+
"commitScopes": [],
17+
"releaseTagGlobPattern": "v[0-9]*.[0-9]*.[0-9]*",
18+
"issueRegexPattern": "(^|\\s)#\\d+(\\s|$)"
19+
},
20+
"changelog" : {
21+
"commitTypes": [
22+
"feat",
23+
"fix",
24+
"perf",
25+
"merge"
26+
],
27+
"includeInvalidCommits": true,
28+
"commitScopes": [],
29+
"commitIgnoreRegexPattern": "^WIP ",
30+
"headlines": {
31+
"feat": "Features",
32+
"fix": "Bug Fixes",
33+
"perf": "Performance Improvements",
34+
"merge": "Merged Branches",
35+
"breakingChange": "BREAKING CHANGES"
36+
},
37+
"commitUrl": "https://github.com/ACCOUNT/REPOSITORY/commit/%commit%",
38+
"commitRangeUrl": "https://github.com/ACCOUNT/REPOSITORY/compare/%from%...%to%?diff=split",
39+
"issueUrl": "https://github.com/ACCOUNT/REPOSITORY/issues/%issue%"
40+
}
41+
}

0 commit comments

Comments
 (0)