mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-08-22 19:38:35 +00:00
fix: changed ip detection logic based on review and added initial terraform 0.13 compatibility for the example module
This commit is contained in:
parent
6fee532f92
commit
c077ea4060
24
Makefile
24
Makefile
@ -1,8 +1,27 @@
|
||||
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
|
||||
NAME=$$(grep TerraformProviderName proxmoxtf/version.go | grep -o -e 'terraform-provider-[a-z]*')
|
||||
TARGETS=darwin linux windows
|
||||
TERRAFORM_PLUGIN_EXTENSION=
|
||||
VERSION=$$(grep TerraformProviderVersion proxmoxtf/version.go | grep -o -e '[0-9]\.[0-9]\.[0-9]')
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
TERRAFORM_CACHE_DIRECTORY=$$(cygpath -u "$(APPDATA)")/terraform.d/plugins
|
||||
TERRAFORM_PLATFORM=windows_amd64
|
||||
TERRAFORM_PLUGIN_EXTENSION=.exe
|
||||
else
|
||||
TERRAFORM_CACHE_DIRECTORY=$(HOME)/terraform.d/plugins
|
||||
UNAME_S=$$(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
TERRAFORM_PLATFORM=darwin_amd64
|
||||
else
|
||||
TERRAFORM_PLATFORM=linux_amd64
|
||||
endif
|
||||
endif
|
||||
|
||||
TERRAFORM_PLUGIN_DIRECTORY=$(TERRAFORM_CACHE_DIRECTORY)/terraform.danitso.com/provider/proxmox/$(VERSION)/$(TERRAFORM_PLATFORM)
|
||||
TERRAFORM_PLUGIN_EXECUTABLE=$(TERRAFORM_PLUGIN_DIRECTORY)/$(NAME)_v$(VERSION)_x4$(TERRAFORM_PLUGIN_EXTENSION)
|
||||
|
||||
default: build
|
||||
|
||||
build:
|
||||
@ -19,6 +38,11 @@ example-destroy:
|
||||
example-init:
|
||||
rm -f "example/$(NAME)_v"*
|
||||
go build -o "example/$(NAME)_v$(VERSION)-custom_x4"
|
||||
|
||||
mkdir -p "$(TERRAFORM_PLUGIN_DIRECTORY)"
|
||||
rm -f "$(TERRAFORM_PLUGIN_EXECUTABLE)"
|
||||
cp "example/$(NAME)_v$(VERSION)-custom_x4" "$(TERRAFORM_PLUGIN_EXECUTABLE)"
|
||||
|
||||
cd ./example && terraform init
|
||||
|
||||
example-plan:
|
||||
|
14
example/versions.tf
Normal file
14
example/versions.tf
Normal file
@ -0,0 +1,14 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
local = {
|
||||
source = "hashicorp/local"
|
||||
}
|
||||
proxmox = {
|
||||
source = "terraform.danitso.com/provider/proxmox"
|
||||
}
|
||||
tls = {
|
||||
source = "hashicorp/tls"
|
||||
}
|
||||
}
|
||||
required_version = ">= 0.13"
|
||||
}
|
@ -180,16 +180,14 @@ func (c *VirtualEnvironmentClient) WaitForNetworkInterfacesFromVMAgent(nodeName
|
||||
missingIP := false
|
||||
|
||||
if waitForIP {
|
||||
if len(*data.Result) == 0 {
|
||||
missingIP = true
|
||||
} else if len(*data.Result) == 1 && (*data.Result)[0].Name == "lo" {
|
||||
missingIP = true
|
||||
} else {
|
||||
for _, nic := range *data.Result {
|
||||
if nic.IPAddresses != nil && len(*nic.IPAddresses) == 0 {
|
||||
missingIP = true
|
||||
break
|
||||
}
|
||||
for _, nic := range *data.Result {
|
||||
if nic.Name == "lo" {
|
||||
continue
|
||||
}
|
||||
|
||||
if nic.IPAddresses == nil || (nic.IPAddresses != nil && len(*nic.IPAddresses) == 0) {
|
||||
missingIP = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user