diff options
author | Flavio Castelli <flavio@castelli.name> | 2016-10-10 15:11:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-10 15:11:56 +0200 |
commit | 47f938971bb94d24751664eb1f9bf807e27557fa (patch) | |
tree | 4da4edbbe1f72a39f250a87c6e288c2001bdee48 /libvirt | |
parent | 5238f7cc9eb3a01e4f43984fb23c4066edd30e45 (diff) | |
parent | 1893b9764661f0007041871d45b364efb513452d (diff) | |
download | terraform-provider-libvirt-47f938971bb94d24751664eb1f9bf807e27557fa.tar terraform-provider-libvirt-47f938971bb94d24751664eb1f9bf807e27557fa.tar.gz |
Merge pull request #69 from flavio/better-handling-of-domain-creation-errors
Better handling of errors while creating a domain
Diffstat (limited to 'libvirt')
-rw-r--r-- | libvirt/resource_libvirt_domain.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go index d9945f73..5783928e 100644 --- a/libvirt/resource_libvirt_domain.go +++ b/libvirt/resource_libvirt_domain.go @@ -96,6 +96,13 @@ func resourceLibvirtDomainExists(d *schema.ResourceData, meta interface{}) (bool func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Create resource libvirt_domain") + // Ensure partial mode to save some relevant keys + d.Partial(true) + + // the domain ID must always be saved, otherwise it won't be possible to cleanup a domain + // if something bad happens at provisioning time + d.SetPartial("id") + virConn := meta.(*Client).libvirt if virConn == nil { return fmt.Errorf("The libvirt connection was nil.") |