Skip to content

Commit

Permalink
Makefile (#1)
Browse files Browse the repository at this point in the history
* feat: adding the abiltity to validate the examples

* fix: adding a fix to the validation of all examples

* feat: adding the clean stage to the makefile
  • Loading branch information
gambol99 authored Apr 11, 2024
1 parent 8d6a4f9 commit bab0b84
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
AUTHOR_EMAIL[email protected]

.PHONY: all security lint format documentation documentation-examples
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init

default: all

Expand Down Expand Up @@ -45,10 +45,24 @@ init:
@echo "--> Running terraform init"
@terraform init -backend=false

validate-all:
@echo "--> Running all validation checks"
$(MAKE) validate
$(MAKE) validate-examples

validate:
@echo "--> Running terraform validate"
@terraform init -backend=false
@terraform validate

validate-examples:
@echo "--> Running terraform validate on examples"
@find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Validating $$dir"; \
terraform -chdir=$$dir init; \
terraform -chdir=$$dir validate; \
done

lint:
@echo "--> Running tflint"
@tflint --init
Expand All @@ -57,3 +71,10 @@ lint:
format:
@echo "--> Running terraform fmt"
@terraform fmt -recursive -write=true

clean:
@echo "--> Cleaning up"
@find . -type d -name ".terraform" | while read -r dir; do \
echo "--> Removing $$dir"; \
rm -rf $$dir; \
done

0 comments on commit bab0b84

Please sign in to comment.