This repository has been archived by the owner on Dec 5, 2020. It is now read-only.
forked from jenkins-x/terraform-google-jx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (46 loc) · 1.66 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
59
60
61
SHELL_SPEC_DIR ?= /var/tmp
TERRAFORM_VAR_FILE = terraform.tfvars
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -h -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: apply
apply: ## Applies Terraform plan w/ auto approve
@test -s $(TERRAFORM_VAR_FILE) || { echo "The 'apply' rule assumes that variables are provided $(TERRAFORM_VAR_FILE)"; exit 1; }
terraform apply -auto-approve --var-file $(TERRAFORM_VAR_FILE)
.PHONY: destroy
destroy: ## Destroys Terraform infrastructure w/ auto approve
terraform destroy -auto-approve --var-file $(TERRAFORM_VAR_FILE)
.PHONY: plan
plan: ## Outputs the Terraform plan
terraform plan --var-file $(TERRAFORM_VAR_FILE) -no-color
.PHONY: show-plan
show-plan: ## Outputs the Terraform plan
terraform plan --var-file $(TERRAFORM_VAR_FILE) -no-color -out=tfplan.out
terraform show -json tfplan.out
rm tfplan.out
.PHONY: init
init: ## Init the terraform module
terraform init
.PHONY: tf-version
tf-version: ## checks the terraform version
terraform version
.PHONY: lint
lint: init tf-version fmt ## Verifies Terraform syntax
terraform validate
.PHONY: fmt
fmt: ## Reformats Terraform files accoring to standard
terraform fmt -check -diff -recursive
.PHONY: test
test: ## Runs ShellSpec tests
shellspec --format document
.PHONY: test-focus
test-focus: ## Runs focused ShellSpec tests
shellspec --focus --format document
.PHONY: clean
clean: ## Deletes temporary files
@rm -rf report
@rm -f jx-requirements.yml
.PHONY: markdown-table
markdown-table: ## Creates markdown tables for in- and output of this module
terraform-docs markdown table .