Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions libvirt/resource_libvirt_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ func resourceLibvirtDomainCreate(ctx context.Context, d *schema.ResourceData, me
}
}

// We save runnig state to not mix what we have and what we want
// We save running state to not mix what we have and what we want
requiredStatus := d.Get("running")

if diag := resourceLibvirtDomainRead(ctx, d, meta); diag.HasError() {
Expand Down Expand Up @@ -691,7 +691,7 @@ func resourceLibvirtDomainUpdate(ctx context.Context, d *schema.ResourceData, me
return diag.FromErr(err)
}

if !domainRunningNow {
if !domainRunningNow && d.Get("running").(bool) {
err = virConn.DomainCreate(domain)
if err != nil {
return diag.Errorf("error creating libvirt domain: %s", err)
Expand Down Expand Up @@ -772,6 +772,10 @@ func resourceLibvirtDomainUpdate(ctx context.Context, d *schema.ResourceData, me
}
}

if err := destroyDomainByUserRequest(virConn, d, domain); err != nil {
return diag.FromErr(err)
}

return nil
}

Expand Down