forked from FairwindsOps/terraform-vpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (23 loc) · 1.04 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
.DEFAULT_GOAL := help
.PHONY: help requirements test
TEMPDIR := $(shell mktemp -d)
TF_VERSION = 0.7.9
TF_PLATFORM = darwin
SHELL := /bin/bash
bin/terraform:
wget https://releases.hashicorp.com/terraform/$(TF_VERSION)/terraform_$(TF_VERSION)_$(TF_PLATFORM)_amd64.zip
unzip terraform_$(TF_VERSION)_$(TF_PLATFORM)_amd64.zip -d bin/
requirements: bin/terraform ## Install required software
test: requirements ## Execute all tests
@for i in `find . -name terraform.\*.tfvars.example`; do \
bin/terraform plan -var-file $$i 1> $(TEMPDIR)/$$i.output && \
diff tests/fixtures/$$i.output $(TEMPDIR)/$$i.output; \
if [[ $$? -ne 0 ]] ; then exit 1; fi; \
done
@echo "Temp directory: $(TEMPDIR)"
fixtures: requirements ## Rebuild test fixture terraform plan output files
@for i in `find . -name terraform.\*.tfvars.example`; do \
bin/terraform plan -var-file $$i 1> tests/fixtures/$$i.output; \
done
help: ## Halp!
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'