From f403e945936d765c442da03c1b89edae89975541 Mon Sep 17 00:00:00 2001 From: Claude Dioudonnat Date: Tue, 29 Oct 2019 14:00:37 +0100 Subject: [PATCH] Set id when updateconfig fail --- proxmox/resource_vm_qemu.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/proxmox/resource_vm_qemu.go b/proxmox/resource_vm_qemu.go index afe303b..7d36f3d 100644 --- a/proxmox/resource_vm_qemu.go +++ b/proxmox/resource_vm_qemu.go @@ -388,9 +388,9 @@ func resourceVmQemu() *schema.Resource { Optional: true, }, "ipconfig2": { - Type: schema.TypeString, - Optional: true, - }, + Type: schema.TypeString, + Optional: true, + }, "preprovision": { Type: schema.TypeBool, Optional: true, @@ -512,6 +512,8 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error { log.Print("[DEBUG] cloning VM") err = config.CloneVm(sourceVmr, vmr, client) if err != nil { + // Set the id because when update config fail the vm is still created + d.SetId(resourceId(targetNode, "qemu", vmr.VmId())) pmParallelEnd(pconf) return err } @@ -542,6 +544,8 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error { err := config.UpdateConfig(vmr, client) if err != nil { + // Set the id because when update config fail the vm is still created + d.SetId(resourceId(targetNode, "qemu", vmr.VmId())) pmParallelEnd(pconf) return err }