-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
1 changed file
with
22 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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 | ||
|
@@ -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 |