-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
58 lines (44 loc) · 1.02 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
54
55
56
57
58
TFLINTRC := .tflint.hcl
MODULEFILES := $(wildcard *.tf)
.PHONY: default
default: checkfmt validate docs lint
.PHONY: checkfmt
checkfmt: .fmt
.PHONY: fmt
fmt: $(MODULEFILES)
terraform fmt
@touch .fmt
.PHONY: validate
validate: .validate
.PHONY: docs
docs: README.md
.PHONY: lint
lint: .lint
.lint: $(MODULEFILES) .lintinit
tflint --config=$(TFLINTRC)
@touch .lint
.lintinit: $(TFLINTRC)
tflint --init --config=$(TFLINTRC)
@touch .lintinit
README.md: $(MODULEFILES)
terraform-docs markdown table . --output-file README.md --lockfile=false
.fmt: $(MODULEFILES)
terraform fmt -check
@touch .fmt
.PHONY: init
init: .init
.init: versions.tf
terraform init -backend=false
@touch .init
.validate: .init $(MODULEFILES) $(wildcard *.tf.example)
echo | cat - $(wildcard *.tf.example) > test.tf
if AWS_DEFAULT_REGION=us-east-1 terraform validate; then \
rm test.tf; \
touch .validate; \
else \
rm test.tf; \
false; \
fi
.PHONY: clean
clean:
rm -rf .fmt .init .lint .lintinit .terraform .terraform.lock.hcl .validate