Skip to content

Commit

Permalink
Merge pull request #108 from claudusd/keep_id_updateconfig_fail
Browse files Browse the repository at this point in the history
Set id when updateconfig fail
  • Loading branch information
ggongaware committed Nov 4, 2019
2 parents fc3b001 + f403e94 commit 0f7edc6
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 @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 0f7edc6

Please sign in to comment.