OPENSHIFT_4_AZURE_GITHUB_USER ?= $(GITHUB_USER)
OPENSHIFT_4_AZURE_GITHUB_TOKEN ?= $(GITHUB_TOKEN)
OPENSHIFT_4_AZURE_GIT_TF_DEPLOY_PROJECT ?= "https://$(OPENSHIFT_4_AZURE_GITHUB_USER):$(OPENSHIFT_4_AZURE_GITHUB_TOKEN)@github.com/open-cluster-management/tf_openshift_4.git"
OPENSHIFT_4_AZURE_GIT_TF_DEPLOY_BRANCH ?= master
OPENSHIFT_4_AZURE_DEPLOY_DIR ?= .deploy-openshift4-azure/
OPENSHIFT_4_AZURE_TERRAFORM_VARS_FILE ?= .deploy-openshift4-azure.tfvars
OPENSHIFT_4_AZURE_TERRAFORM_VERSION ?= 0.12.18

.PHONY: deploy/openshift4/azure
## Deploy openshift on azure
deploy/openshift4/azure:
	@$(GIT) clone -b $(OPENSHIFT_4_AZURE_GIT_TF_DEPLOY_BRANCH) $(OPENSHIFT_4_AZURE_GIT_TF_DEPLOY_PROJECT) $(OPENSHIFT_4_AZURE_DEPLOY_DIR)
	@$(SELF) terraform:apply TERRAFORM_VARS_FILE=$(OPENSHIFT_4_AZURE_TERRAFORM_VARS_FILE) TERRAFORM_DIR=$(OPENSHIFT_4_AZURE_DEPLOY_DIR)/azure-ipi TERRAFORM_VER=$(OPENSHIFT_4_AZURE_TERRAFORM_VERSION)

.PHONY: deploy/openshift4/azure/destroy
## Destroy openshift on azure deployment resources
deploy/openshift4/azure/destroy: %destroy:
	@$(SELF) terraform:destroy TERRAFORM_VARS_FILE=$(OPENSHIFT_4_AZURE_TERRAFORM_VARS_FILE) TERRAFORM_DIR=$(OPENSHIFT_4_AZURE_DEPLOY_DIR)/azure-ipi TERRAFORM_VER=$(OPENSHIFT_4_AZURE_TERRAFORM_VERSION)

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