aboutsummaryrefslogtreecommitdiff
path: root/examples/uefi
diff options
context:
space:
mode:
authorJ. Eduardo <j.eduardo@gmail.com>2017-07-31 22:16:24 +0200
committerFlavio Castelli <flavio@castelli.me>2017-08-01 09:11:49 +0200
commit968bf16201a9f13030f84765b027d7e45fdbef57 (patch)
tree2f581ce06f099681af4550c25593365428b06b21 /examples/uefi
parent78341e5971cac8f23e7c36321180a71ee6816131 (diff)
downloadterraform-provider-libvirt-968bf16201a9f13030f84765b027d7e45fdbef57.tar
terraform-provider-libvirt-968bf16201a9f13030f84765b027d7e45fdbef57.tar.gz
Added support for specifying NVRAM templates when using UEFI images.
Diffstat (limited to 'examples/uefi')
-rw-r--r--examples/uefi/libvirt.tf38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/uefi/libvirt.tf b/examples/uefi/libvirt.tf
new file mode 100644
index 00000000..1419806f
--- /dev/null
+++ b/examples/uefi/libvirt.tf
@@ -0,0 +1,38 @@
+provider "libvirt" {
+ uri = "qemu:///system"
+}
+
+resource "libvirt_volume" "ubuntu-cloud-uefi" {
+ name = "ubuntu-cloud-uefi"
+ source = "https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-uefi1.img"
+}
+
+resource "libvirt_volume" "volume" {
+ name = "vm${count.index}"
+ base_volume_id = "${libvirt_volume.ubuntu-cloud-uefi.id}"
+ count = 1
+}
+
+resource "libvirt_domain" "domain" {
+ count = 2
+ name = "ubuntu-cloud-${count.index}"
+ memory = "512"
+ vcpu = 1
+ # This file is usually present as part of the ovmf firmware package in many
+ # Linux distributions.
+ firmware = "/usr/share/OVMF/OVMF_CODE.fd"
+ nvram {
+ # This is the file which will back the UEFI NVRAM content.
+ file = "/var/lib/libvirt/qemu/nvram/vm${count.index}_VARS.fd"
+ # This file needs to be provided by the user.
+ template = "/srv/provisioning/terraform/debian-stable-uefi_VARS.fd"
+ }
+ disk {
+ volume_id = "${element(libvirt_volume.volume.*.id, count.index)}"
+ }
+ graphics {
+ type = "spice"
+ listen_type = "address"
+ autoport = true
+ }
+