-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (43 loc) · 1.12 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 := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := check
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
TERRAFORM := terraform
MODULES := $(wildcard modules/*)
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX =
.PHONY: help
help:
@echo "Usage: make <target>"
@echo
@echo "Targets:"
@echo " init Initialize the Terraform working directory"
@echo " check Check if the configuration is well formatted (default)"
@echo " format Format the configuration"
@echo " validate Validate the configuration"
@echo " clean Clean the Terraform working directory"
TOPTARGETS := init validate clean
$(TOPTARGETS): $(MODULES)
$(MODULES):
@$(MAKE) -sC $@ $(MAKECMDGOALS)
.PHONY: $(TOPTARGETS) $(MODULES)
.PHONY: init
init:
$(TERRAFORM) init -backend=false
.PHONY: check
check:
$(TERRAFORM) fmt -check -recursive
.PHONY: format
format:
$(TERRAFORM) fmt -recursive
.PHONY: validate
validate: init
$(TERRAFORM) validate
.PHONY: clean
clean:
@rm -rf .terraform