aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hipp <thipp@suse.de>2017-08-08 10:00:15 +0200
committerFlavio Castelli <flavio@castelli.me>2017-08-08 11:31:45 +0200
commit51fbd4082fba1797cc33b77b2a31f99bafd9be4a (patch)
tree7b64d7a971fc6826de027ef00f9d8a32f0c9e49e
parent8e74bea665840557cc3783c9f2c80d920ec88b85 (diff)
downloadterraform-provider-libvirt-51fbd4082fba1797cc33b77b2a31f99bafd9be4a.tar
terraform-provider-libvirt-51fbd4082fba1797cc33b77b2a31f99bafd9be4a.tar.gz
cloudinit: handle changes correctly
Use the correct cloudinit ID if things have changed. This fixes #145. Signed-off-by: Thomas Hipp <thipp@suse.de>
-rw-r--r--libvirt/resource_libvirt_domain.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go
index 975b1b93..1044223d 100644
--- a/libvirt/resource_libvirt_domain.go
+++ b/libvirt/resource_libvirt_domain.go
@@ -675,12 +675,16 @@ func resourceLibvirtDomainUpdate(d *schema.ResourceData, meta interface{}) error
d.Partial(true)
if d.HasChange("cloudinit") {
- cloudinit, err := newDiskForCloudInit(virConn, d.Get("cloudinit").(string))
+ cloudinitID, err := getCloudInitVolumeKeyFromTerraformID(d.Get("cloudinit").(string))
+ if err != nil {
+ return err
+ }
+ disk, err := newDiskForCloudInit(virConn, cloudinitID)
if err != nil {
return err
}
- data, err := xml.Marshal(cloudinit)
+ data, err := xml.Marshal(disk)
if err != nil {
return fmt.Errorf("Error serializing cloudinit disk: %s", err)
}