summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean Smith <dean@zelotus.com>2017-08-29 08:26:10 +0100
committerDean Smith <dean@zelotus.com>2017-08-29 12:44:49 +0100
commit0ac07fb315a7f2537e4a921fb08a2f9048f21bdc (patch)
treea61bb9d96aa0d966020f74a0eb4a65dd06abb594
parent1ec3dcdefd17561926eee63f59460e015af91d78 (diff)
downloadterraform-provider-libvirt-0ac07fb315a7f2537e4a921fb08a2f9048f21bdc.tar
terraform-provider-libvirt-0ac07fb315a7f2537e4a921fb08a2f9048f21bdc.tar.gz
Adding support for arch and machine type
This adds support for setting the architecture and machine type of the created virtual machine by adding two new attributes machine and arch to the domain definition
-rw-r--r--libvirt/resource_libvirt_domain.go11
-rw-r--r--website/docs/r/domain.html.markdown5
2 files changed, 16 insertions, 0 deletions
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go
index 1044223d..561cb712 100644
--- a/libvirt/resource_libvirt_domain.go
+++ b/libvirt/resource_libvirt_domain.go
@@ -147,6 +147,14 @@ func resourceLibvirtDomain() *schema.Resource {
Optional: true,
Required: false,
},
+ "machine": &schema.Schema{
+ Type: schema.TypeString,
+ Optional: true,
+ },
+ "arch": &schema.Schema{
+ Type: schema.TypeString,
+ Optional: true,
+ },
},
}
}
@@ -239,6 +247,9 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error
}
}
+ domainDef.OS.Type.Arch = d.Get("arch").(string)
+ domainDef.OS.Type.Machine = d.Get("machine").(string)
+
if firmware, ok := d.GetOk("firmware"); ok {
firmwareFile := firmware.(string)
if _, err := os.Stat(firmwareFile); os.IsNotExist(err) {
diff --git a/website/docs/r/domain.html.markdown b/website/docs/r/domain.html.markdown
index bdb71077..5fae0006 100644
--- a/website/docs/r/domain.html.markdown
+++ b/website/docs/r/domain.html.markdown
@@ -50,6 +50,11 @@ The following arguments are supported:
* `coreos_ignition` - (Optional) The
[libvirt_ignition](/docs/providers/libvirt/r/coreos_ignition.html) resource
that is to be used by the CoreOS domain.
+* `arch` - (Optional) The architecture for the VM (probably x86_64 or i686),
+ you normally won't need to set this unless you are building a special VM
+* `machine` - (Optional) The machine type,
+ you normally won't need to set this unless you are running on a platform that
+ defaults to the wrong machine type for your template
### UEFI images