diff --git a/Makefile b/Makefile index b2b64b26b..fc2863c6c 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ PROJECT_NAME := provider-jet-azure PROJECT_REPO := github.com/crossplane-contrib/$(PROJECT_NAME) +export TERRAFORM_VERSION ?= 1.0.5 +export TERRAFORM_PROVIDER_SOURCE ?= hashicorp/azurerm +export TERRAFORM_PROVIDER_VERSION ?= 2.78.0 + PLATFORMS ?= linux_amd64 linux_arm64 # -include will silently skip missing files, which allows us @@ -100,9 +104,8 @@ provider-jet-azure.vendor: prepare.azurerm vendor # must match Docker build file env. variable TERRAFORM_PROVIDER_AZURERM_VERSION in # cluster/images/provider-jet-azure-controller/Dockerfile -AZURERM_REFSPEC ?= v2.78.0 prepare.azurerm: - @WORK_DIR=.work AZURERM_REFSPEC=$(AZURERM_REFSPEC) ./scripts/prepare_azurerm.sh + @WORK_DIR=.work TERRAFORM_PROVIDER_VERSION=$(TERRAFORM_PROVIDER_VERSION) ./scripts/prepare_azurerm.sh codegen.pipeline: prepare.azurerm @USE_INCLUDE_LIST=true go run cmd/generator/main.go diff --git a/cluster/images/provider-jet-azure-controller/Dockerfile b/cluster/images/provider-jet-azure-controller/Dockerfile index 77c74901b..cdde94405 100644 --- a/cluster/images/provider-jet-azure-controller/Dockerfile +++ b/cluster/images/provider-jet-azure-controller/Dockerfile @@ -7,7 +7,6 @@ ARG TERRAFORM_PROVIDER_SOURCE ARG TERRAFORM_PROVIDER_VERSION ARG TINI_VERSION ENV USER_ID=1001 -# must match Makefile variable AZURERM_REFSPEC ENV TERRAFORM_PROVIDER_VERSION=$TERRAFORM_PROVIDER_VERSION ENV TERRAFORM_PROVIDER_SOURCE=$TERRAFORM_PROVIDER_SOURCE diff --git a/cluster/images/provider-jet-azure-controller/Makefile b/cluster/images/provider-jet-azure-controller/Makefile index 245ffca0a..ee22430f1 100755 --- a/cluster/images/provider-jet-azure-controller/Makefile +++ b/cluster/images/provider-jet-azure-controller/Makefile @@ -2,12 +2,6 @@ # Setup Project PLATFORMS := linux_amd64 linux_arm64 -# Terraform configuration -# TODO(aru): how to pass these from root Makefile? -TERRAFORM_VERSION ?= 1.0.5 -TERRAFORM_PROVIDER_SOURCE ?= hashicorp/azurerm -# version specified here should currently match the `AZURERM_REFSPEC` variable of the root Makefile -TERRAFORM_PROVIDER_VERSION ?= 2.78.0 include ../../../build/makelib/common.mk diff --git a/go.mod b/go.mod index 918c2dca5..f9d633c02 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/crossplane/terrajet v0.4.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0 // github.com/hashicorp/terraform-provider-azurerm is replaced with ./.work/.azurerm - // and the dependency version is specified in the Makefile via make variable AZURERM_REFSPEC + // and the dependency version is specified in the Makefile via make variable TERRAFORM_PROVIDER_VERSION github.com/hashicorp/terraform-provider-azurerm v0.0.0 github.com/pkg/errors v0.9.1 gopkg.in/alecthomas/kingpin.v2 v2.2.6 diff --git a/scripts/prepare_azurerm.sh b/scripts/prepare_azurerm.sh index c544fc63d..661269997 100755 --- a/scripts/prepare_azurerm.sh +++ b/scripts/prepare_azurerm.sh @@ -24,8 +24,8 @@ if [ ! -d "${REPO_DIR}/.git" ]; then git -C "${REPO_DIR}" remote add origin https://github.com/hashicorp/terraform-provider-azurerm fi -git -C "${REPO_DIR}" fetch origin "${AZURERM_REFSPEC}" +git -C "${REPO_DIR}" fetch origin v"${TERRAFORM_PROVIDER_VERSION}" git -C "${REPO_DIR}" reset --hard FETCH_HEAD mkdir -p "${REPO_DIR}/xpprovider" -cp hack/provider.go.txt "${REPO_DIR}/xpprovider/provider.go" \ No newline at end of file +cp hack/provider.go.txt "${REPO_DIR}/xpprovider/provider.go"