mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-08-23 03:48: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:
commit
74d895f305
24
Makefile
24
Makefile
@ -1,8 +1,27 @@
|
|||||||
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
|
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
|
||||||
NAME=$$(grep TerraformProviderName proxmoxtf/version.go | grep -o -e 'terraform-provider-[a-z]*')
|
NAME=$$(grep TerraformProviderName proxmoxtf/version.go | grep -o -e 'terraform-provider-[a-z]*')
|
||||||
TARGETS=darwin linux windows
|
TARGETS=darwin linux windows
|
||||||
|
TERRAFORM_PLUGIN_EXTENSION=
|
||||||
VERSION=$$(grep TerraformProviderVersion proxmoxtf/version.go | grep -o -e '[0-9]\.[0-9]\.[0-9]')
|
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
|
default: build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@ -19,6 +38,11 @@ example-destroy:
|
|||||||
example-init:
|
example-init:
|
||||||
rm -f "example/$(NAME)_v"*
|
rm -f "example/$(NAME)_v"*
|
||||||
go build -o "example/$(NAME)_v$(VERSION)-custom_x4"
|
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
|
cd ./example && terraform init
|
||||||
|
|
||||||
example-plan:
|
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"
|
||||||
|
}
|
@ -181,7 +181,11 @@ func (c *VirtualEnvironmentClient) WaitForNetworkInterfacesFromVMAgent(nodeName
|
|||||||
|
|
||||||
if waitForIP {
|
if waitForIP {
|
||||||
for _, nic := range *data.Result {
|
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
|
missingIP = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -1622,11 +1622,8 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa
|
|||||||
resource := resourceVirtualEnvironmentContainer()
|
resource := resourceVirtualEnvironmentContainer()
|
||||||
|
|
||||||
// Prepare the new primitive values.
|
// Prepare the new primitive values.
|
||||||
if d.HasChange(mkResourceVirtualEnvironmentContainerDescription) {
|
description := d.Get(mkResourceVirtualEnvironmentContainerDescription).(string)
|
||||||
description := d.Get(mkResourceVirtualEnvironmentContainerDescription).(string)
|
updateBody.Description = &description
|
||||||
|
|
||||||
updateBody.Description = &description
|
|
||||||
}
|
|
||||||
|
|
||||||
template := proxmox.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
template := proxmox.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
||||||
|
|
||||||
@ -1853,7 +1850,7 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = veClient.WaitForContainerState(nodeName, vmID, "running", 120, 5)
|
err = veClient.WaitForContainerState(nodeName, vmID, "running", 300, 5)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1871,7 +1868,7 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = veClient.WaitForContainerState(nodeName, vmID, "stopped", 30, 5)
|
err = veClient.WaitForContainerState(nodeName, vmID, "stopped", 300, 5)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user