-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from hazelops/feature/refactor-v2.0.0
v2 Refactor (BREAKING CHANGES)
- Loading branch information
Showing
65 changed files
with
1,124 additions
and
694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
# Uses editorconfig to maintain consistent coding styles | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 300 | ||
trim_trailing_whitespace = true | ||
|
||
[*.{tf,tfvars}] | ||
indent_size = 2 | ||
indent_style = space | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false | ||
|
||
[Makefile] | ||
tab_width = 2 | ||
indent_style = tab | ||
|
||
[COMMIT_EDITMSG] | ||
max_line_length = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: "Tests: Pre-Commit" | ||
concurrency: # This need to ensure that only a single job or workflow using the same concurrency group will run at a time. | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
TERRAFORM_DOCS_VERSION: v0.16.0 | ||
TFLINT_VERSION: v0.50.3 | ||
|
||
jobs: | ||
collectInputs: | ||
name: Collect workflow inputs | ||
runs-on: ubuntu-latest | ||
outputs: | ||
directories: ${{ steps.dirs.outputs.directories }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get root directories | ||
id: dirs | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
|
||
preCommitMinVersions: | ||
name: Min TF pre-commit | ||
needs: collectInputs | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }} | ||
steps: | ||
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449 | ||
- name: Delete huge unnecessary tools folder | ||
run: | | ||
rm -rf /opt/hostedtoolcache/CodeQL | ||
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk | ||
rm -rf /opt/hostedtoolcache/Ruby | ||
rm -rf /opt/hostedtoolcache/go | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Terraform min/max versions | ||
id: minMax | ||
uses: clowdhaus/[email protected] | ||
with: | ||
directory: ${{ matrix.directory }} | ||
|
||
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }} | ||
# Run only validate pre-commit check on min version supported | ||
if: ${{ matrix.directory != '.' }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
with: | ||
terraform-version: ${{ steps.minMax.outputs.minVersion }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*' | ||
|
||
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }} | ||
# Run only validate pre-commit check on min version supported | ||
if: ${{ matrix.directory == '.' }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
with: | ||
terraform-version: ${{ steps.minMax.outputs.minVersion }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)' | ||
|
||
preCommitMaxVersion: | ||
name: Max TF pre-commit | ||
runs-on: ubuntu-latest | ||
needs: collectInputs | ||
steps: | ||
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449 | ||
- name: Delete huge unnecessary tools folder | ||
run: | | ||
rm -rf /opt/hostedtoolcache/CodeQL | ||
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk | ||
rm -rf /opt/hostedtoolcache/Ruby | ||
rm -rf /opt/hostedtoolcache/go | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{github.event.pull_request.head.repo.full_name}} | ||
|
||
- name: Terraform min/max versions | ||
id: minMax | ||
uses: clowdhaus/[email protected] | ||
|
||
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }} | ||
uses: clowdhaus/terraform-composite-actions/[email protected] | ||
with: | ||
terraform-version: ${{ steps.minMax.outputs.maxVersion }} | ||
tflint-version: ${{ env.TFLINT_VERSION }} | ||
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }} | ||
install-hcledit: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
repos: | ||
- repo: https://github.com/antonbabenko/pre-commit-terraform | ||
rev: v1.89.0 | ||
hooks: | ||
- id: terraform_fmt | ||
- id: terraform_docs | ||
args: | ||
- '--args=--lockfile=false' | ||
- id: terraform_tflint | ||
args: | ||
- '--args=--only=terraform_deprecated_interpolation' | ||
- '--args=--only=terraform_deprecated_index' | ||
- '--args=--only=terraform_unused_declarations' | ||
- '--args=--only=terraform_comment_syntax' | ||
- '--args=--only=terraform_documented_outputs' | ||
- '--args=--only=terraform_documented_variables' | ||
- '--args=--only=terraform_typed_variables' | ||
- '--args=--only=terraform_module_pinned_source' | ||
- '--args=--only=terraform_naming_convention' | ||
- '--args=--only=terraform_required_version' | ||
- '--args=--only=terraform_required_providers' | ||
- '--args=--only=terraform_standard_module_structure' | ||
- '--args=--only=terraform_workspace_remote' | ||
- '--args=--only=terraform_unused_required_providers' | ||
- id: terraform_validate | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.