generated from appvia/terraform-aws-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): updating inline with the upstream template
- Loading branch information
Showing
9 changed files
with
143 additions
and
123 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,19 @@ | ||
--- | ||
rules: | ||
body-leading-blank: [1, always] | ||
body-max-line-length: [2, always, 100] | ||
footer-leading-blank: [1, always] | ||
footer-max-line-length: [2, always, 100] | ||
header-max-length: [2, always, 100] | ||
subject-case: | ||
- 2 | ||
- never | ||
- [sentence-case, start-case, pascal-case, upper-case] | ||
subject-empty: [2, never] | ||
subject-full-stop: [2, never, "."] | ||
type-case: [2, always, lower-case] | ||
type-empty: [2, never] | ||
type-enum: | ||
- 2 | ||
- always | ||
- [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] |
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
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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
# | ||
# Copyright (C) 2024 Appvia Ltd <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
|
@@ -14,43 +12,59 @@ | |
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
AUTHOR_EMAIL[email protected] | ||
|
||
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init examples | ||
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init examples tests | ||
|
||
default: all | ||
|
||
all: | ||
$(MAKE) init | ||
$(MAKE) validate | ||
$(MAKE) tests | ||
$(MAKE) lint | ||
$(MAKE) security | ||
$(MAKE) format | ||
$(MAKE) documentation | ||
|
||
examples: | ||
@echo "--> Running examples" | ||
$(MAKE) documentation | ||
$(MAKE) validate-examples | ||
examples: | ||
$(MAKE) validate-examples | ||
$(MAKE) tests | ||
$(MAKE) lint-examples | ||
$(MAKE) security-examples | ||
$(MAKE) lint | ||
$(MAKE) security | ||
$(MAKE) format | ||
$(MAKE) documentation | ||
|
||
documentation: | ||
@echo "--> Generating documentation" | ||
@terraform-docs markdown table --output-file ${PWD}/README.md --output-mode inject . | ||
@terraform-docs . | ||
$(MAKE) documentation-modules | ||
$(MAKE) documentation-examples | ||
|
||
documentation-modules: | ||
@echo "--> Generating documentation for modules" | ||
@if [ -d modules ]; then \ | ||
find modules -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \ | ||
fi | ||
@find . -type d -regex '.*/modules/[a-za-z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \ | ||
echo "--> Generating documentation for module: $$dir"; \ | ||
terraform-docs $$dir; \ | ||
done; | ||
|
||
documentation-examples: | ||
@echo "--> Generating documentation examples" | ||
@echo "--> Generating documentation for examples" | ||
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null| while read -r dir; do \ | ||
echo "--> Generating documentation for example: $$dir"; \ | ||
terraform-docs $$dir; \ | ||
done; | ||
|
||
upgrade-terraform-providers: | ||
@printf "%s Upgrading Terraform providers for %-24s" "-->" "." | ||
@terraform init -upgrade >/dev/null && echo "[OK]" || echo "[FAILED]" | ||
@$(MAKE) upgrade-terraform-example-providers | ||
|
||
upgrade-terraform-example-providers: | ||
@if [ -d examples ]; then \ | ||
find examples -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \ | ||
find examples -type d -mindepth 1 -maxdepth 1 2>/dev/null | while read -r dir; do \ | ||
printf "%s Upgrading Terraform providers for %-24s" "-->" "$$dir"; \ | ||
terraform -chdir=$$dir init -upgrade >/dev/null && echo "[OK]" || echo "[FAILED]"; \ | ||
done; \ | ||
fi | ||
|
||
init: | ||
|
@@ -65,48 +79,50 @@ security: | |
|
||
security-modules: | ||
@echo "--> Running Security checks on modules" | ||
@if [ -d modules ]; then \ | ||
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \ | ||
echo "--> Validating $$dir"; \ | ||
trivy config $$dir; \ | ||
done; \ | ||
fi | ||
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \ | ||
echo "--> Validating $$dir"; \ | ||
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \ | ||
done; | ||
|
||
security-examples: | ||
@echo "--> Running Security checks on examples" | ||
@if [ -d examples ]; then \ | ||
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \ | ||
echo "--> Validating $$dir"; \ | ||
trivy config $$dir; \ | ||
done; \ | ||
fi | ||
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \ | ||
echo "--> Validating $$dir"; \ | ||
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \ | ||
done; | ||
|
||
tests: | ||
@echo "--> Running Terraform Tests" | ||
@terraform test | ||
|
||
validate: | ||
@echo "--> Running terraform validate" | ||
@terraform init -backend=false | ||
@terraform validate | ||
$(MAKE) validate-modules | ||
$(MAKE) validate-examples | ||
$(MAKE) validate-commits | ||
|
||
validate-modules: | ||
@echo "--> Running terraform validate on modules" | ||
@if [ -d modules ]; then \ | ||
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \ | ||
echo "--> Validating $$dir"; \ | ||
terraform -chdir=$$dir init -backend=false; \ | ||
terraform -chdir=$$dir validate; \ | ||
done; \ | ||
fi | ||
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \ | ||
echo "--> Validating Module $$dir"; \ | ||
terraform -chdir=$$dir init -backend=false; \ | ||
terraform -chdir=$$dir validate; \ | ||
done; | ||
|
||
validate-examples: | ||
@echo "--> Running terraform validate on examples" | ||
@if [ -d examples ]; then \ | ||
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \ | ||
echo "--> Validating $$dir"; \ | ||
terraform -chdir=$$dir init -backend=false; \ | ||
terraform -chdir=$$dir validate; \ | ||
done; \ | ||
fi | ||
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \ | ||
echo "--> Validating $$dir"; \ | ||
terraform -chdir=$$dir init -backend=false; \ | ||
terraform -chdir=$$dir validate; \ | ||
done; | ||
|
||
validate-commits: | ||
@echo "--> Running commitlint against the main branch" | ||
@command -v commitlint >/dev/null 2>&1 || { echo "commitlint is not installed. Please install it by running 'npm install -g commitlint'"; exit 1; } | ||
@git log --pretty=format:"%s" origin/main..HEAD | commitlint --from=origin/main | ||
|
||
lint: | ||
@echo "--> Running tflint" | ||
|
@@ -117,31 +133,27 @@ lint: | |
|
||
lint-modules: | ||
@echo "--> Running tflint on modules" | ||
@if [ -d modules ]; then \ | ||
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \ | ||
echo "--> Linting $$dir"; \ | ||
tflint --chdir=$$dir --init; \ | ||
tflint --chdir=$$dir -f compact; \ | ||
done; \ | ||
fi | ||
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \ | ||
echo "--> Linting $$dir"; \ | ||
tflint --chdir=$$dir --init; \ | ||
tflint --chdir=$$dir -f compact; \ | ||
done; | ||
|
||
lint-examples: | ||
@echo "--> Running tflint on examples" | ||
@if [ -d examples ]; then \ | ||
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \ | ||
echo "--> Linting $$dir"; \ | ||
tflint --chdir=$$dir --init; \ | ||
tflint --chdir=$$dir -f compact; \ | ||
done; \ | ||
fi | ||
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \ | ||
echo "--> Linting $$dir"; \ | ||
tflint --chdir=$$dir --init; \ | ||
tflint --chdir=$$dir -f compact; \ | ||
done; | ||
|
||
format: | ||
@echo "--> Running terraform fmt" | ||
@terraform fmt -recursive -write=true | ||
|
||
clean: | ||
@echo "--> Cleaning up" | ||
@find . -type d -name ".terraform" | while read -r dir; do \ | ||
@find . -type d -name ".terraform" 2>/dev/null | while read -r dir; do \ | ||
echo "--> Removing $$dir"; \ | ||
rm -rf $$dir; \ | ||
done |
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
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,13 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
## Providers | ||
|
||
No providers. | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END_TF_DOCS --> |
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,13 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
## Providers | ||
|
||
No providers. | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END_TF_DOCS --> |