0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-08-22 19:38:35 +00:00

Merge pull request #35 from danitso/fix/agent-ip-addresses

Fix lack of IP addresses from QEMU agent
This commit is contained in:
Dan R. Petersen 2020-10-25 23:01:37 +01:00 committed by GitHub
commit 74d895f305
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 8 deletions

View File

@ -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
View 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"
}

View File

@ -181,7 +181,11 @@ func (c *VirtualEnvironmentClient) WaitForNetworkInterfacesFromVMAgent(nodeName
if waitForIP {
for _, nic := range *data.Result {
if nic.IPAddresses != nil && len(*nic.IPAddresses) == 0 {
if nic.Name == "lo" {
continue
}
if nic.IPAddresses == nil || (nic.IPAddresses != nil && len(*nic.IPAddresses) == 0) {
missingIP = true
break
}

View File

@ -1622,11 +1622,8 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa
resource := resourceVirtualEnvironmentContainer()
// Prepare the new primitive values.
if d.HasChange(mkResourceVirtualEnvironmentContainerDescription) {
description := d.Get(mkResourceVirtualEnvironmentContainerDescription).(string)
updateBody.Description = &description
}
template := proxmox.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
@ -1853,7 +1850,7 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa
return err
}
err = veClient.WaitForContainerState(nodeName, vmID, "running", 120, 5)
err = veClient.WaitForContainerState(nodeName, vmID, "running", 300, 5)
if err != nil {
return err
@ -1871,7 +1868,7 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa
return err
}
err = veClient.WaitForContainerState(nodeName, vmID, "stopped", 30, 5)
err = veClient.WaitForContainerState(nodeName, vmID, "stopped", 300, 5)
if err != nil {
return err