-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
46 lines (36 loc) · 1.37 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
TF_DOCS := $(shell which terraform-docs 2> /dev/null)
TF_FILES = $(shell find . -type f -name "*.tf" -exec dirname {} \; | sort -u)
TF_TESTS = $(shell find ./tests -type f -name "*.tf" -exec dirname {} \;|sort -u)
SEMTAG=tools/semtag
TAG_QUERY=v1.0.0..
scope ?= "minor"
define terraform-docs
$(if $(TF_DOCS),,$(error "terraform-docs revision >= a8b59f8 is required (https://github.com/segmentio/terraform-docs)"))
@echo '<!-- DO NOT EDIT. THIS FILE IS GENERATED BY THE MAKEFILE. -->' > $1
@echo '# Terraform variables inputs and outputs' >> $1
@echo $2 >> $1
terraform-docs markdown $3 $4 $5 $6 >> $1
endef
.PHONY: validate
validate:
@for m in $(TF_TESTS); do terraform init "$$m" > /dev/null 2>&1; echo "$$m: "; cd "$$m" ;terraform validate "."; cd -; done
.PHONY: validate-ign
validate-ign:
@(cd tests && \
terraform init > /dev/null 2>&1 && \
terraform apply -auto-approve && \
(ignition-validate output/etcd.ign && echo "√ output/etcd.ign: Success! The ignition configuration is valid."))
.PHONY: fmt
fmt:
@for m in $(TF_FILES); do (terraform fmt -diff "$$m" && echo "√ $$m"); done
.PHONY: changelog
changelog:
git-chglog -o CHANGELOG.md $(TAG_QUERY)
.PHONY: release
release:
$(SEMTAG) final -s $(scope)
.PHONY: docs
docs:
$(call terraform-docs, docs/variables.md, \
'This document gives an overview of variables used in the Ignition of the etcd module.\n', \
./)