aboutsummaryrefslogtreecommitdiff
path: root/terraform
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-03-16 08:51:54 +0000
committerChristopher Baines <mail@cbaines.net>2018-03-29 07:55:01 +0100
commit051c8bf612126fa79699c8bf45a661dde127f4a0 (patch)
tree849a3b05b4ab4b59a426761d7cf1da3cc7036349 /terraform
parenta8c8f68971dd9e20dee01d9f65c64283e41fe4a3 (diff)
downloadgovuk-mini-environment-admin-051c8bf612126fa79699c8bf45a661dde127f4a0.tar
govuk-mini-environment-admin-051c8bf612126fa79699c8bf45a661dde127f4a0.tar.gz
Add backend controllers, models and views
Also annotate existing models.
Diffstat (limited to 'terraform')
-rw-r--r--terraform/libvirt/mini_environment.tf68
1 files changed, 68 insertions, 0 deletions
diff --git a/terraform/libvirt/mini_environment.tf b/terraform/libvirt/mini_environment.tf
new file mode 100644
index 0000000..4b9965d
--- /dev/null
+++ b/terraform/libvirt/mini_environment.tf
@@ -0,0 +1,68 @@
+terraform {
+ backend "http" {}
+}
+
+variable "machine_name" {
+ type = "string"
+}
+
+variable "uri" {
+ type = "string"
+}
+
+variable "vm_image_and_system" {
+ type = "string"
+}
+
+provider "libvirt" {
+ uri = "${var.uri}"
+}
+
+resource "libvirt_network" "vm_network" {
+ name = "vm_network"
+ addresses = ["10.0.1.0/24"]
+}
+
+# Create the machine
+resource "libvirt_domain" "domain-ubuntu" {
+ name = "${var.machine_name}"
+ memory = "8196"
+ vcpu = 4
+
+ kernel = "${var.vm_image_and_system}/system/kernel/bzImage"
+ initrd = "${var.vm_image_and_system}/system/initrd"
+
+ cmdline {
+ "--root" = "/dev/vda1"
+ "--system" = "${var.vm_image_and_system}/system"
+ "--load" = "${var.vm_image_and_system}/system/boot"
+ }
+
+ filesystem {
+ source = "/gnu/store"
+ target = "TAG_gnu_store"
+ readonly = true
+ accessmode = "passthrough"
+ }
+
+ disk {
+ file = "${var.vm_image_and_system}/image"
+ readonly = true
+ }
+
+ network_interface {
+ network_name = "${libvirt_network.vm_network.name}"
+ }
+
+ console {
+ type = "pty"
+ target_port = "0"
+ target_type = "serial"
+ }
+
+ console {
+ type = "pty"
+ target_type = "virtio"
+ target_port = "1"
+ }
+}