diff options
author | Duncan Mac-Vicar P <dmacvicar@suse.de> | 2017-11-16 13:50:06 +0100 |
---|---|---|
committer | Duncan Mac-Vicar P <dmacvicar@suse.de> | 2017-11-19 16:52:33 +0100 |
commit | 5ea094a4686747eba27dd1ced6b380300424f88f (patch) | |
tree | 23632d9b7fb7d02c95795cf0119d44f3a4319b5f | |
parent | bb8be0df22f5635a6d2efc70d4372d2321dfc0f2 (diff) | |
download | terraform-provider-libvirt-5ea094a4686747eba27dd1ced6b380300424f88f.tar terraform-provider-libvirt-5ea094a4686747eba27dd1ced6b380300424f88f.tar.gz |
Document disks from url
-rw-r--r-- | libvirt/disk_def.go | 2 | ||||
-rw-r--r-- | libvirt/disk_def_test.go | 2 | ||||
-rw-r--r-- | libvirt/resource_libvirt_domain.go | 2 | ||||
-rw-r--r-- | website/docs/r/domain.html.markdown | 11 |
4 files changed, 13 insertions, 4 deletions
diff --git a/libvirt/disk_def.go b/libvirt/disk_def.go index 785542b6..f4e4e86a 100644 --- a/libvirt/disk_def.go +++ b/libvirt/disk_def.go @@ -9,7 +9,7 @@ import ( const oui = "05abcd" -func newDefDisk() libvirtxml.DomainDisk { +func newDefDisk(i int) libvirtxml.DomainDisk { return libvirtxml.DomainDisk{ Type: "file", Device: "disk", diff --git a/libvirt/disk_def_test.go b/libvirt/disk_def_test.go index 1e3141d5..a6184cc6 100644 --- a/libvirt/disk_def_test.go +++ b/libvirt/disk_def_test.go @@ -13,7 +13,7 @@ func init() { } func TestDefaultDiskMarshall(t *testing.T) { - b := newDefDisk() + b := newDefDisk(0) buf := new(bytes.Buffer) enc := xml.NewEncoder(buf) enc.Indent(" ", " ") diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go index dfb9d2f9..e5034352 100644 --- a/libvirt/resource_libvirt_domain.go +++ b/libvirt/resource_libvirt_domain.go @@ -368,7 +368,7 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error var disks []libvirtxml.DomainDisk var scsiDisk = false for i := 0; i < disksCount; i++ { - disk := newDefDisk() + disk := newDefDisk(i) diskKey := fmt.Sprintf("disk.%d", i) diskMap := d.Get(diskKey).(map[string]interface{}) diff --git a/website/docs/r/domain.html.markdown b/website/docs/r/domain.html.markdown index c9bbfbaa..b047a6e7 100644 --- a/website/docs/r/domain.html.markdown +++ b/website/docs/r/domain.html.markdown @@ -143,7 +143,12 @@ resource "libvirt_domain" "my_machine" { The `disk` block supports: -* `volume_id` - (Required) The volume id to use for this disk. +* `volume_id` - (Optional) The volume id to use for this disk. +* `url` - (Optional) The http url to use as the block device for this disk (read-only) + +While both `volume_id` and `url` are optional, it is intended that you use either a volume or a +url. + * `scsi` - (Optional) Use a scsi controller for this disk. The controller model is set to `virtio-scsi` * `wwn` - (Optional) Specify a WWN to use for the disk if the disk is using @@ -167,6 +172,10 @@ resource "libvirt_domain" "domain1" { volume_id = "${libvirt_volume.mydisk.id}" scsi = "yes" } + + disk { + url = "http://foo.com/install.iso" + } } ``` |