Skip to content

Commit

Permalink
Merge pull request #1039 from Tinyblargon/#1023
Browse files Browse the repository at this point in the history
feat: stop VM when deleting
  • Loading branch information
Tinyblargon authored Jun 9, 2024
2 parents b6bf7d6 + bc2e9f3 commit ad3264f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -1612,13 +1612,7 @@ func resourceVmQemuDelete(ctx context.Context, d *schema.ResourceData, meta inte
return diag.FromErr(err)
}
if vmState["status"] != "stopped" {
var err error
if d.Get("agent") == 1 {
_, err = client.ShutdownVm(vmr)
} else {
_, err = client.StopVm(vmr)
}
if err != nil {
if _, err := client.StopVm(vmr); err != nil {
return diag.FromErr(err)
}

Expand Down

0 comments on commit ad3264f

Please sign in to comment.