Skip to content

Commit

Permalink
Set id when updateconfig fail
Browse files Browse the repository at this point in the history
  • Loading branch information
claudusd committed Oct 29, 2019
1 parent 7a4a86f commit f403e94
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit f403e94

Please sign in to comment.