diff --git a/proxmox/resource_vm_qemu.go b/proxmox/resource_vm_qemu.go index 5196f9d..293e034 100644 --- a/proxmox/resource_vm_qemu.go +++ b/proxmox/resource_vm_qemu.go @@ -392,9 +392,9 @@ func resourceVmQemu() *schema.Resource { Optional: true, }, "ipconfig2": { - Type: schema.TypeString, - Optional: true, - }, + Type: schema.TypeString, + Optional: true, + }, "preprovision": { Type: schema.TypeBool, Optional: true, @@ -517,6 +517,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 } @@ -547,6 +549,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 }