-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
24 lines (18 loc) · 929 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
TFSTATE_BUCKET=mccurdyc-dot-dev-tfstate
default: help
.PHONY: install-tools
install-tools: ## Installs helpful tools.
pip install j2cli
.PHONY: gen-variables
gen-variables: ## Fills in the templated sensitive information.
j2 -f json terraform/terraform.tfvars.j2 terraform/config.json -o terraform/terraform.tfvars
.PHONY: push-tfstate-files
push-tfstate-files: ## Pushes the Terraform state files _to_ a GCP Cloud Storage bucket.
gsutil cp terraform/*.tfstate* gs://$(TFSTATE_BUCKET)/
.PHONY: pull-tfstate-files
pull-tfstate-files: ## Pulls the Terraform state files _from_ a GCP Cloud Storage bucket.
gsutil cp gs://$(TFSTATE_BUCKET)/terraform.tfstate terraform/
gsutil cp gs://$(TFSTATE_BUCKET)/terraform.tfstate.backup terraform/
.PHONY: help
help: ## Prints this help menu.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'