Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): Fix make example-init for TF 1.4 #262

Merged
merged 2 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 14 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)"

Expand All @@ -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:
Expand Down Expand Up @@ -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)
11 changes: 4 additions & 7 deletions example.tfrc
Original file line number Diff line number Diff line change
@@ -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 {}
}
7 changes: 3 additions & 4 deletions example/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}