Skip to content

Commit 5891052

Browse files
authored
Merge pull request #1 from tomarv2/develop
.
2 parents 7bf73d9 + a7f46fb commit 5891052

22 files changed

+460
-193
lines changed

.github/workflows/onrelease.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
7+
name: release
8+
9+
jobs:
10+
generate-changelog:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- uses: BobAnkh/auto-generate-changelog@master
17+
with:
18+
REPO_NAME: ''
19+
ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
20+
BRANCH: ''
21+
PATH: 'CHANGELOG.md'
22+
COMMIT_MESSAGE: 'docs(CHANGELOG): update release notes'
23+
TYPE: 'feat:Feature,fix:Bug Fixes,docs:Documentation,refactor:Refactor,perf:Performance Improvements'
24+
build:
25+
name: Create Release
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v2
30+
31+
- name: Create Release
32+
id: create_release
33+
uses: actions/create-release@v1
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
tag_name: ${{ github.ref }}
38+
release_name: Release ${{ github.ref }}
39+
body: |
40+
Release for version ${{ github.ref }}. Please check CHANGELOG.md for more information.
41+
draft: false
42+
prerelease: false

.github/workflows/pre-commit.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Pre-Commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
10+
jobs:
11+
# Min Terraform version(s)
12+
getDirectories:
13+
name: Get root directories
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.8'
23+
architecture: 'x64'
24+
25+
- name: Build matrix
26+
id: matrix
27+
run: |
28+
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/providers.tf', '') for x in glob.glob('./**/providers.tf', recursive=True)]))")
29+
echo "::set-output name=directories::$DIRS"
30+
outputs:
31+
directories: ${{ steps.matrix.outputs.directories }}
32+
33+
preCommitMinVersions:
34+
name: Min TF validate
35+
needs: getDirectories
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v2
43+
44+
- name: Install Python
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: '3.8'
48+
architecture: 'x64'
49+
50+
- name: Terraform min/max versions
51+
id: minMax
52+
uses: clowdhaus/terraform-min-max@v1.0.1
53+
with:
54+
directory: ${{ matrix.directory }}
55+
56+
- name: Install Terraform v${{ steps.minMax.outputs.minVersion }}
57+
uses: hashicorp/setup-terraform@v1
58+
with:
59+
terraform_version: ${{ steps.minMax.outputs.minVersion }}
60+
61+
- name: Install pre-commit dependencies
62+
run: pip install pre-commit
63+
64+
65+
# Max Terraform version
66+
getBaseVersion:
67+
name: Module max TF version
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Checkout
71+
uses: actions/checkout@v2
72+
73+
- name: Terraform min/max versions
74+
id: minMax
75+
uses: clowdhaus/terraform-min-max@v1.0.1
76+
outputs:
77+
minVersion: ${{ steps.minMax.outputs.minVersion }}
78+
maxVersion: ${{ steps.minMax.outputs.maxVersion }}
79+
80+
preCommitMaxVersion:
81+
name: Max TF pre-commit
82+
runs-on: ubuntu-latest
83+
needs: getBaseVersion
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
version:
88+
- ${{ needs.getBaseVersion.outputs.maxVersion }}
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v2
92+
93+
- name: Install Python
94+
uses: actions/setup-python@v2
95+
with:
96+
python-version: '3.8'
97+
architecture: 'x64'
98+
99+
- name: Install Terraform v${{ matrix.version }}
100+
uses: hashicorp/setup-terraform@v1
101+
with:
102+
terraform_version: ${{ matrix.version }}
103+
104+
- name: Install pre-commit dependencies
105+
run: |
106+
pip install pre-commit
107+
pip install checkov
108+
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v1.0.1-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
109+
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
110+
111+
- name: Execute pre-commit
112+
# Run all pre-commit checks on max version supported
113+
if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}
114+
run: pre-commit run --color=always --show-diff-on-failure --all-files

.github/workflows/security_scans.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Bump version
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Bump version and push tag
12+
id: tag_version
13+
uses: mathieudutour/github-tag-action@v6.0
14+
with:
15+
github_token: ${{ secrets.GITHUB_TOKEN }}
16+
17+
- name: Create a GitHub release
18+
uses: ncipollo/release-action@v1
19+
with:
20+
tag: ${{ steps.tag_version.outputs.new_tag }}
21+
name: Release ${{ steps.tag_version.outputs.new_tag }}
22+
body: ${{ steps.tag_version.outputs.changelog }}

.gitignore

Lines changed: 131 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ override.tf.json
2929
# example: *tfplan*
3030

3131
.idea/
32+
.vscode/
3233
.terraform.lock.hcl
3334

3435
# go
@@ -79,5 +80,133 @@ _testmain.go
7980
/test/run.out
8081
/test/times.out
8182

82-
# ignore test related file(s)
83-
**/test**
83+
# Python
84+
# Editors
85+
86+
# Vagrant
87+
.vagrant/
88+
89+
# Windows
90+
Thumbs.db
91+
92+
# Source for the following rules: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
93+
# Byte-compiled / optimized / DLL files
94+
__pycache__/
95+
*.py[cod]
96+
*$py.class
97+
98+
# Distribution / packaging
99+
.Python
100+
build/
101+
develop-eggs/
102+
dist/
103+
downloads/
104+
eggs/
105+
.eggs/
106+
lib/
107+
lib64/
108+
parts/
109+
sdist/
110+
var/
111+
wheels/
112+
*.egg-info/
113+
.installed.cfg
114+
*.egg
115+
MANIFEST
116+
117+
# PyInstaller
118+
# Usually these files are written by a python script from a template
119+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
120+
*.manifest
121+
*.spec
122+
123+
# Installer logs
124+
pip-log.txt
125+
pip-delete-this-directory.txt
126+
127+
# Unit test / coverage reports
128+
htmlcov/
129+
.tox/
130+
.nox/
131+
.coverage
132+
.coverage.*
133+
.cache
134+
nosetests.xml
135+
coverage.xml
136+
*.cover
137+
.hypothesis/
138+
.pytest_cache/
139+
140+
# Translations
141+
*.mo
142+
*.pot
143+
144+
# Django stuff:
145+
*.log
146+
local_settings.py
147+
db.sqlite3
148+
149+
# Flask stuff:
150+
instance/
151+
.webassets-cache
152+
153+
# Scrapy stuff:
154+
.scrapy
155+
156+
# Sphinx documentation
157+
docs/_build/
158+
159+
# PyBuilder
160+
target/
161+
162+
# Jupyter Notebook
163+
.ipynb_checkpoints
164+
165+
# IPython
166+
profile_default/
167+
ipython_config.py
168+
169+
# pyenv
170+
.python-version
171+
172+
# celery beat schedule file
173+
celerybeat-schedule
174+
175+
# SageMath parsed files
176+
*.sage.py
177+
178+
# Environments
179+
.env
180+
.venv
181+
env/
182+
venv/
183+
ENV/
184+
env.bak/
185+
venv.bak/
186+
187+
# Spyder project settings
188+
.spyderproject
189+
.spyproject
190+
191+
# Rope project settings
192+
.ropeproject
193+
194+
# mkdocs documentation
195+
/site
196+
197+
# mypy
198+
.mypy_cache/
199+
.dmypy.json
200+
dmypy.json
201+
202+
# Terraform external modules
203+
**/.external_modules
204+
205+
# Test files and directories
206+
**/[Tt]est/*
207+
**/[Tt]ests/*
208+
**/*[Tt]est*/*
209+
**/*[Tt]ests*/*
210+
211+
# remote_backend.tf file
212+
**/remote_backend.tf

.pre-commit-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
repos:
2+
- repo: git://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.60.0
4+
hooks:
5+
- id: terraform_fmt
6+
- id: terraform_tflint
7+
args:
8+
- '--args=--only=terraform_deprecated_interpolation'
9+
- '--args=--only=terraform_deprecated_index'
10+
- '--args=--only=terraform_unused_declarations'
11+
- '--args=--only=terraform_comment_syntax'
12+
- '--args=--only=terraform_documented_outputs'
13+
- '--args=--only=terraform_documented_variables'
14+
- '--args=--only=terraform_typed_variables'
15+
- '--args=--only=terraform_module_pinned_source'
16+
- '--args=--only=terraform_naming_convention'
17+
- '--args=--only=terraform_required_providers'
18+
- '--args=--only=terraform_standard_module_structure'
19+
- '--args=--only=terraform_workspace_remote'
20+
21+
- repo: https://github.com/pre-commit/pre-commit-hooks
22+
rev: v4.1.0
23+
hooks:
24+
- id: trailing-whitespace
25+
- id: end-of-file-fixer
26+
- id: check-docstring-first
27+
- id: check-yaml
28+
- id: debug-statements
29+
- id: double-quote-string-fixer
30+
- id: name-tests-test
31+
- id: requirements-txt-fixer
32+
33+
- repo: https://github.com/bridgecrewio/checkov.git
34+
rev: '2.0.914'
35+
hooks:
36+
- id: checkov
37+
verbose: true
38+
args: [-d, '.', --framework,'terraform']

0 commit comments

Comments
 (0)