0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00

fix(vm): edge case of deleting incomplete VM if create fails and provider retries (#1684)

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
Pavel Boldyrev 2024-12-17 14:27:30 -05:00 committed by GitHub
parent 3d020a1441
commit bf9e2436d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,8 +94,7 @@ func (c *Client) CreateVMAsync(ctx context.Context, d *CreateRequestBody) (*stri
"error": err.Error(),
})
e := c.DoRequest(ctx, http.MethodDelete, c.ExpandPath("?destroy-unreferenced-disks=1&purge=1"), nil, nil)
if e != nil {
if e := c.DeleteVM(ctx); e != nil {
tflog.Warn(ctx, "deleting VM after failed creation", map[string]interface{}{
"error": e,
})