Skip to content

Commit

Permalink
build: refine terraform version checking logic and messaging
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Watts <jbw976@gmail.com>
  • Loading branch information
jbw976 committed Jun 5, 2024
1 parent 4a0a4eb commit ab054a8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ export TERRAFORM_VERSION ?= 1.5.7

# Do not allow a version of terraform greater than 1.5.x, due to versions 1.6+ being
# licensed under BSL, which is not permitted.
export TERRAFORM_VERSION_CEILING ?= 1.6
TERRAFORM_VERSION_VALID := $(shell [ $(TERRAFORM_VERSION) = `echo "$(TERRAFORM_VERSION)\n$(TERRAFORM_VERSION_CEILING)" | sort -V | head -n1` ] && echo 1 || echo 0)
TERRAFORM_VERSION_VALID := $(shell [ "$(TERRAFORM_VERSION)" = "`printf "$(TERRAFORM_VERSION)\n1.6" | sort -V | head -n1`" ] && echo 1 || echo 0)

export TERRAFORM_PROVIDER_SOURCE ?= conradludgate/spotify
export TERRAFORM_PROVIDER_REPO ?= https://github.com/conradludgate/terraform-provider-spotify
Expand Down Expand Up @@ -107,7 +106,7 @@ TERRAFORM_PROVIDER_SCHEMA := config/schema.json

check-terraform-version:
ifneq ($(TERRAFORM_VERSION_VALID),1)
$(error invalid TERRAFORM_VERSION $(TERRAFORM_VERSION), must be less than $(TERRAFORM_VERSION_CEILING))
$(error invalid TERRAFORM_VERSION $(TERRAFORM_VERSION), must be less than 1.6.0 since that version introduced a not permitted BSL license))
endif

$(TERRAFORM): check-terraform-version
Expand Down

0 comments on commit ab054a8

Please sign in to comment.