From 914631f58b40ceb25248727ac23a6400df0264a3 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Thu, 16 Mar 2023 22:09:41 -0400 Subject: [PATCH] fix(build): Fix make example-init for TF 1.4 (#262) * fix(build): Fix make example-init for TF 1.4 * add 1.4.2 to versions list --- .github/workflows/test.yml | 4 ++-- Makefile | 25 ++++++++++++++----------- example.tfrc | 11 ++++------- example/versions.tf | 7 +++---- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fbcd61c5..1b485e5f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,9 +49,9 @@ jobs: matrix: # list whatever Terraform versions here you would like to support terraform: - - '1.1.9' - '1.2.9' - - '1.3.2' + - '1.3.8' + - '1.4.2' steps: - name: Set up Go diff --git a/Makefile b/Makefile index a93b4791..a214a487 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ NAME=terraform-provider-proxmox TARGETS=darwin linux windows TERRAFORM_PLUGIN_EXTENSION= VERSION=0.14.0# x-release-please-version -VERSION_EXAMPLE=9999.0.0 ifeq ($(OS),Windows_NT) TERRAFORM_PLATFORM=windows_amd64 @@ -14,15 +13,19 @@ else TERRAFORM_PLUGIN_CACHE_DIRECTORY=$(shell pwd -P)/cache/plugins endif -TERRAFORM_PLUGIN_DIRECTORY=$(TERRAFORM_PLUGIN_CACHE_DIRECTORY)/registry.terraform.io/bpg/proxmox/$(VERSION)/$(TERRAFORM_PLATFORM) -TERRAFORM_PLUGIN_DIRECTORY_EXAMPLE=$(TERRAFORM_PLUGIN_CACHE_DIRECTORY)/registry.terraform.io/bpg/proxmox/$(VERSION_EXAMPLE)/$(TERRAFORM_PLATFORM) -TERRAFORM_PLUGIN_EXECUTABLE=$(TERRAFORM_PLUGIN_DIRECTORY)/$(NAME)_v$(VERSION)_x4$(TERRAFORM_PLUGIN_EXTENSION) -TERRAFORM_PLUGIN_EXECUTABLE_EXAMPLE=$(TERRAFORM_PLUGIN_DIRECTORY_EXAMPLE)/$(NAME)_v$(VERSION_EXAMPLE)_x4$(TERRAFORM_PLUGIN_EXTENSION) +TERRAFORM_PLUGIN_OUTPUT_DIRECTORY=./build +TERRAFORM_PLUGIN_EXECUTABLE=$(TERRAFORM_PLUGIN_OUTPUT_DIRECTORY)/$(NAME)_v$(VERSION)$(TERRAFORM_PLUGIN_EXTENSION) +TERRAFORM_PLUGIN_EXECUTABLE_EXAMPLE=$(TERRAFORM_PLUGIN_OUTPUT_DIRECTORY)/$(NAME)$(TERRAFORM_PLUGIN_EXTENSION) default: build +clean: + rm -rf ./dist + rm -rf ./cache + rm -rf ./build + build: - mkdir -p "$(TERRAFORM_PLUGIN_DIRECTORY)" + mkdir -p "$(TERRAFORM_PLUGIN_OUTPUT_DIRECTORY)" rm -f "$(TERRAFORM_PLUGIN_EXECUTABLE)" go build -o "$(TERRAFORM_PLUGIN_EXECUTABLE)" @@ -36,8 +39,8 @@ example-apply: && terraform apply -auto-approve example-build: - rm -rf "$(TERRAFORM_PLUGIN_DIRECTORY_EXAMPLE)" - mkdir -p "$(TERRAFORM_PLUGIN_DIRECTORY_EXAMPLE)" + mkdir -p "$(TERRAFORM_PLUGIN_OUTPUT_DIRECTORY)" + rm -rf "$(TERRAFORM_PLUGIN_EXECUTABLE_EXAMPLE)" go build -o "$(TERRAFORM_PLUGIN_EXECUTABLE_EXAMPLE)" example-destroy: @@ -75,10 +78,10 @@ test: $(TARGETS): GOOS=$@ GOARCH=amd64 CGO_ENABLED=0 go build \ - -o "dist/$@/$(NAME)_v$(VERSION)-custom_x4" \ + -o "dist/$@/$(NAME)_v$(VERSION)-custom" \ -a -ldflags '-extldflags "-static"' zip \ -j "dist/$(NAME)_v$(VERSION)-custom_$@_amd64.zip" \ - "dist/$@/$(NAME)_v$(VERSION)-custom_x4" + "dist/$@/$(NAME)_v$(VERSION)-custom" -.PHONY: build example example-apply example-destroy example-init example-plan fmt init targets test $(TARGETS) +.PHONY: clean build example example-apply example-destroy example-init example-plan fmt init targets test $(TARGETS) diff --git a/example.tfrc b/example.tfrc index 7dbe362b..b9e47acf 100644 --- a/example.tfrc +++ b/example.tfrc @@ -1,9 +1,6 @@ provider_installation { - filesystem_mirror { - path = "../cache/plugins" - include = ["registry.terraform.io/bpg/proxmox"] - } - direct { - exclude = ["registry.terraform.io/bpg/proxmox"] - } + dev_overrides { + "bpg/proxmox" = "../build" + } + direct {} } diff --git a/example/versions.tf b/example/versions.tf index 082d95cf..d7642c09 100644 --- a/example/versions.tf +++ b/example/versions.tf @@ -4,13 +4,12 @@ terraform { source = "hashicorp/local" version = "2.2.2" } - proxmox = { - source = "bpg/proxmox" - version = "9999.0.0" - } tls = { source = "hashicorp/tls" version = "3.1.0" } + proxmox = { + source = "bpg/proxmox" + } } }