OPENSHIFT_4_GCP_GITHUB_USER ?= $(GITHUB_USER)
OPENSHIFT_4_GCP_GITHUB_TOKEN ?= $(GITHUB_TOKEN)
OPENSHIFT_4_GCP_GIT_TF_DEPLOY_PROJECT ?= "https://$(OPENSHIFT_4_GCP_GITHUB_USER):$(OPENSHIFT_4_GCP_GITHUB_TOKEN)@github.com/open-cluster-management/tf_openshift_4.git"
OPENSHIFT_4_GCP_GIT_TF_DEPLOY_BRANCH ?= master
OPENSHIFT_4_GCP_DEPLOY_DIR ?= .deploy-openshift4-gcp/
OPENSHIFT_4_GCP_TERRAFORM_VARS_FILE ?= .deploy-openshift4-gcp.tfvars
OPENSHIFT_4_GCP_TERRAFORM_VERSION ?= 0.12.18

.PHONY: deploy/openshift4/gcp
## Deploy openshift on gcp
deploy/openshift4/gcp:
	@$(GIT) clone -b $(OPENSHIFT_4_GCP_GIT_TF_DEPLOY_BRANCH) $(OPENSHIFT_4_GCP_GIT_TF_DEPLOY_PROJECT) $(OPENSHIFT_4_GCP_DEPLOY_DIR)
	@$(SELF) terraform:apply TERRAFORM_VARS_FILE=$(OPENSHIFT_4_GCP_TERRAFORM_VARS_FILE) TERRAFORM_DIR=$(OPENSHIFT_4_GCP_DEPLOY_DIR)/gcp-ipi TERRAFORM_VER=$(OPENSHIFT_4_GCP_TERRAFORM_VERSION)

.PHONY: deploy/openshift4/gcp/destroy
## Destroy openshift on gcp deployment resources
deploy/openshift4/gcp/destroy: %destroy:
	@$(SELF) terraform:destroy TERRAFORM_VARS_FILE=$(OPENSHIFT_4_GCP_TERRAFORM_VARS_FILE) TERRAFORM_DIR=$(OPENSHIFT_4_GCP_DEPLOY_DIR)/gcp-ipi TERRAFORM_VER=$(OPENSHIFT_4_GCP_TERRAFORM_VERSION)

.PHONY: deploy/openshift4/gcp/clean
## Clean up all openshift on gcp deployment resources
deploy/openshift4/gcp/clean: %clean: %destroy
ifeq ($(shell test -d $(OPENSHIFT_4_GCP_DEPLOY_DIR) && echo -n yes),yes)
	@rm -rf $(OPENSHIFT_4_GCP_DEPLOY_DIR)
endif
