diff --git a/with-terraform/Makefile b/with-terraform/Makefile index f9450bc4..3cae72ba 100644 --- a/with-terraform/Makefile +++ b/with-terraform/Makefile @@ -1,8 +1,24 @@ -fmt: - terraform fmt +#!/usr/bin/env -- make -f +######################################## -plan: - terraform plan +TF := $(command -v terraform) +TFLINT := $(command -v tflint) +TF_OPTS := +TFLINT_OPTS := -apply: - terraform apply \ No newline at end of file +######################################## +.DEFAULT: help +PHONY: all help fmt init plan apply + +help: ## Show this help + @egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' + +deps: init ## install plugins and providers + +all: deps fmt plan ## install dependancies then format and execute 'terraform plan' + +lint: fmt ## format hcl files and run the linter + $(TFLINT) $(TFLINT_OPTS) . + +init fmt plan apply: ## default rule to execute terrafrom sub commands + $(TF) $(TF_OPTS) $@