Skip to content

Commit 0c3cea3

Browse files
authored
Merge branch 'master' into master
2 parents 39a46af + 0c2db00 commit 0c3cea3

File tree

36 files changed

+2189
-985
lines changed

36 files changed

+2189
-985
lines changed

.circleci/config.yml

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

.github/workflows/pre-commit.yml

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

.gitignore

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
1-
.terraform
2-
terraform.tfstate
3-
*.tfstate*
4-
terraform.tfvars
1+
# Local .terraform directories
2+
**/.terraform/*
53

4+
# Terraform lockfile
65
.terraform.lock.hcl
6+
7+
# .tfstate files
8+
*.tfstate
9+
*.tfstate.*
10+
11+
# Crash log files
12+
crash.log
13+
14+
# Exclude all .tfvars files, which are likely to contain sentitive data, such as
15+
# password, private keys, and other secrets. These should not be part of version
16+
# control as they are data points which are potentially sensitive and subject
17+
# to change depending on the environment.
18+
*.tfvars
19+
20+
# Ignore override files as they are usually used to override resources locally and so
21+
# are not checked in
22+
override.tf
23+
override.tf.json
24+
*_override.tf
25+
*_override.tf.json
26+
27+
# Ignore CLI configuration files
28+
.terraformrc
29+
terraform.rc

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.44.0
3+
rev: v1.48.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -21,6 +21,6 @@ repos:
2121
- '--args=--only=terraform_standard_module_structure'
2222
- '--args=--only=terraform_workspace_remote'
2323
- repo: git://github.com/pre-commit/pre-commit-hooks
24-
rev: v3.3.0
24+
rev: v3.4.0
2525
hooks:
2626
- id: check-merge-conflict

0 commit comments

Comments
 (0)