summaryrefslogtreecommitdiff
path: root/libvirt/resource_cloud_init.go
diff options
context:
space:
mode:
authorFlavio Castelli <fcastelli@suse.com>2016-06-27 17:51:11 +0200
committerFlavio Castelli <fcastelli@suse.com>2016-06-27 17:51:11 +0200
commit91e24aa6ba21ab3e772c297c86cd935aac5bc09d (patch)
tree96e0d5da63aec6609ba2a71f9e7fcce0494036e9 /libvirt/resource_cloud_init.go
parentc5ab19a8135306d23b6ad3ad11d21f6c9557584d (diff)
downloadterraform-provider-libvirt-91e24aa6ba21ab3e772c297c86cd935aac5bc09d.tar
terraform-provider-libvirt-91e24aa6ba21ab3e772c297c86cd935aac5bc09d.tar.gz
cloudinit: change the ID used internall by Terraform
Previously the ID was equal to the volume key, hence it was just the path to the ISO file. This caused confusion when a cloudinit resource was regenerated because the key didn't change at all. The new ID is made from the volume key joined with a UUID. Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Diffstat (limited to 'libvirt/resource_cloud_init.go')
-rw-r--r--libvirt/resource_cloud_init.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/libvirt/resource_cloud_init.go b/libvirt/resource_cloud_init.go
index b637ea5d..53a13a7b 100644
--- a/libvirt/resource_cloud_init.go
+++ b/libvirt/resource_cloud_init.go
@@ -95,5 +95,10 @@ func resourceCloudInitDelete(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("The libvirt connection was nil.")
}
- return RemoveVolume(virConn, d.Id())
+ key, err := getCloudInitVolumeKeyFromTerraformID(d.Id())
+ if err != nil {
+ return err
+ }
+
+ return RemoveVolume(virConn, key)
}