From 9febc24d8cb393f9d4acc0e3baa331dbf272be3d Mon Sep 17 00:00:00 2001 From: Kent 'picat' Gruber Date: Thu, 16 Jul 2020 15:57:14 -0400 Subject: [PATCH] Create terraform/gcp/Makefile To help make developing / testing this module much easier in the future. --- terraform/gcp/Makefile | 90 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 terraform/gcp/Makefile diff --git a/terraform/gcp/Makefile b/terraform/gcp/Makefile new file mode 100644 index 000000000..9671c33d6 --- /dev/null +++ b/terraform/gcp/Makefile @@ -0,0 +1,90 @@ +.PHONY: help +help: ## Print this help +help: + @echo 'Usage: make ' + @echo + @echo -e 'Targets:' + @egrep '^(.+)\:\ ##\ (.+)' $(MAKEFILE_LIST) | column -t -c 2 -s ':#' + +.PHONY: packer/validate +packer/validate: ## Validate the HashiStack Packer configuration + packer validate packer.json + +.PHONY: packer/build +packer/build: ## Build the HashiStack image with Packer + time packer build \ + -force \ + -timestamp-ui \ + -var="project=${GOOGLE_PROJECT}" \ + -var="credentials=${GOOGLE_APPLICATION_CREDENTIALS}" \ + packer.json + +.PHONY: terraform/validate +terraform/validate: ## Validate the Terraform configuration + cd modules/hashistack; \ + terraform init; \ + terraform validate . + +.PHONY: terraform/plan +terraform/plan: ## Run a Terraform Plan + cd modules/hashistack; \ + terraform init; \ + terraform plan \ + -var="project=${GOOGLE_PROJECT}" \ + -var="credentials=${GOOGLE_APPLICATION_CREDENTIALS}" + +.PHONY: terraform/apply +terraform/apply: ## Run a Terraform Apply + cd modules/hashistack; \ + terraform init; \ + terraform apply \ + -auto-approve \ + -var="project=${GOOGLE_PROJECT}" \ + -var="credentials=${GOOGLE_APPLICATION_CREDENTIALS}" + +.PHONY: terraform/destroy +terraform/destroy: ## Plan the Terraform configuration + cd modules/hashistack; \ + terraform init; \ + terraform destroy \ + -auto-approve \ + -var="project=${GOOGLE_PROJECT}" \ + -var="credentials=${GOOGLE_APPLICATION_CREDENTIALS}" + +.PHONY: terraform/validate/example/us-east +terraform/validate/example/us-east: ## Validate the Terraform configuration for the us-east example env + cd env/us-east; \ + terraform init; \ + terraform validate . + +.PHONY: terraform/plan/example/us-east +terraform/plan/example/us-east: ## Run a Terraform Plan for the us-east example env + cd env/us-east; \ + terraform init; \ + terraform plan -var="project=${GOOGLE_PROJECT}" -var="credentials=${GOOGLE_APPLICATION_CREDENTIALS}" + +.PHONY: terraform/apply/example/us-east +terraform/apply/example/us-east: ## Run a Terraform Apply for the us-east example env + cd env/us-east; \ + terraform init; \ + terraform apply \ + -auto-approve \ + -var="project=${GOOGLE_PROJECT}" \ + -var="credentials=${GOOGLE_APPLICATION_CREDENTIALS}" + +.PHONY: terraform/destroy/example/us-east +terraform/destroy/example/us-east: ## Plan the Terraform configuration for the us-east example env + cd env/us-east; \ + terraform init; \ + terraform destroy \ + -auto-approve \ + -var="project=${GOOGLE_PROJECT}" \ + -var="credentials=${GOOGLE_APPLICATION_CREDENTIALS}" + +.PHONY: gcloud/login/server +gcloud/login/server: ## Login to a server instance using gcloud + gcloud compute ssh hashistack-server-0 + +.PHONY: gcloud/login/client +gcloud/login/client: ## Login to a client instance using gcloud + gcloud compute ssh hashistack-client-0