diff --git a/Makefile b/Makefile index ae6981e3..c043ed4b 100644 --- a/Makefile +++ b/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: diff --git a/example/versions.tf b/example/versions.tf new file mode 100644 index 00000000..45c50008 --- /dev/null +++ b/example/versions.tf @@ -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" +} diff --git a/proxmox/virtual_environment_vm.go b/proxmox/virtual_environment_vm.go index cff74794..8993977b 100644 --- a/proxmox/virtual_environment_vm.go +++ b/proxmox/virtual_environment_vm.go @@ -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 } diff --git a/proxmoxtf/resource_virtual_environment_container.go b/proxmoxtf/resource_virtual_environment_container.go index f9b7656a..6ff8be89 100644 --- a/proxmoxtf/resource_virtual_environment_container.go +++ b/proxmoxtf/resource_virtual_environment_container.go @@ -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 - } + 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