Skip to content

Commit

Permalink
feat: updating the makefile to validate, lint and run security checks…
Browse files Browse the repository at this point in the history
… on all code and examples by default
  • Loading branch information
gambol99 committed Apr 13, 2024
1 parent a7dbb9d commit 137422d
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 6 deletions.
48 changes: 48 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 24 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@ default: all
all:
$(MAKE) init
$(MAKE) validate
$(MAKE) security
$(MAKE) lint
$(MAKE) security
$(MAKE) format
$(MAKE) documentation
$(MAKE) documentation-examples

security:
@echo "--> Running Security checks"
@tfsec .

documentation:
@echo "--> Generating documentation"
@terraform-docs markdown table --output-file ${PWD}/README.md --output-mode inject .
$(MAKE) documentation-examples

documentation-examples:
@echo "--> Generating documentation examples"
Expand All @@ -45,6 +41,18 @@ init:
@echo "--> Running terraform init"
@terraform init -backend=false

security:
@echo "--> Running Security checks"
@tfsec .
$(MAKE) security-examples

security-examples:
@echo "--> Running Security checks on examples"
@find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Validating $$dir"; \
tfsec $$dir; \
done

validate-all:
@echo "--> Running all validation checks"
$(MAKE) validate
Expand All @@ -54,6 +62,7 @@ validate:
@echo "--> Running terraform validate"
@terraform init -backend=false
@terraform validate
$(MAKE) validate-examples

validate-examples:
@echo "--> Running terraform validate on examples"
Expand All @@ -67,6 +76,15 @@ lint:
@echo "--> Running tflint"
@tflint --init
@tflint -f compact
$(MAKE) lint-examples

lint-examples:
@echo "--> Running tflint on examples"
@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

format:
@echo "--> Running terraform fmt"
Expand Down
48 changes: 48 additions & 0 deletions examples/basic/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 137422d

Please sign in to comment.