-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (44 loc) · 1.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
SHELL := /usr/bin/env bash
##
# Console Colors
##
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
CYAN := $(shell tput -Txterm setaf 6)
RESET := $(shell tput -Txterm sgr0)
.PHONY: help
help: ## show this help.
@echo 'Usage:'
@echo ' ${GREEN}make${RESET} ${YELLOW}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} { \
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${GREEN}%-21s${YELLOW}%s${RESET}\n", $$1, $$2} \
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
}' $(MAKEFILE_LIST)
.PHONY: test-examples
test-examples: ## Run tests on examples
@echo "Running tests on examples"
terraform init -test-directory=tests/examples
terraform test -test-directory=tests/examples
.PHONY: test-local
test-local: ## Run tests on local
@echo "Running tests on local"
terraform init -test-directory=tests/local
terraform test -test-directory=tests/local
.PHONY: test-remote
test-remote: ## Run tests on remote
@echo "Running tests on remote"
terraform init -test-directory=tests/remote
terraform test -test-directory=tests/remote
.PHONY: test
test: test-examples test-local test-remote ## Run all tests
.PHONY: docs
docs: README.md ## Generate Terraform docs and update README.md
ROOT_TF_FILES := $(wildcard *.tf)
EXAMPLES_TF_FILES := $(shell find ./examples -name '*.tf')
TF_FILES := $(ROOT_TF_FILES) $(EXAMPLES_TF_FILES)
README.md: $(TF_FILES) .terraform-docs.yaml
@echo "Generating Terraform docs for README.md"
@terraform-docs . --config .terraform-docs.yaml