-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
41 lines (31 loc) · 771 Bytes
/
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
TERRAFORM ?= terraform
MODULES ?= $(shell find . -type f -name "*.tf" -print0 | xargs -0 -n1 dirname | sort --unique)
.DEFAULT_GOAL := validate
.PHONY: clear
clear:
@rm -rf .terraform
.PHONY: fmt
fmt: clear
$(TERRAFORM) fmt
.PHONY: init
init: clear
$(TERRAFORM) init
.PHONY: tflint
tflint: TARGET=tflint_module
tflint: $(MODULES)
.PHONY: tflint_module
tflint_module: init
tflint --init -c $(PWD)/.tflint.hcl
tflint -c $(PWD)/.tflint.hcl
.PHONY: validate
validate: TARGET=validate_module
validate: validate_fmt $(MODULES)
.PHONY: validate_module
validate_module: init
$(TERRAFORM) validate
.PHONY: validate_fmt
validate_fmt: clear
$(TERRAFORM) fmt -diff=true -check -recursive
.PHONY: $(MODULES)
$(MODULES):
@$(MAKE) -C $@ -f $(PWD)/Makefile $(TARGET)