imfreedom/bamboo-terraform

A bunch of updates
draft
2019-02-06, Gary Kramlich
d3cb1067774e
Parents 21774683eab9
Children 22ea798fcefd
A bunch of updates
--- a/README.md Wed Feb 06 19:53:43 2019 -0600
+++ b/README.md Wed Feb 06 23:09:17 2019 -0600
@@ -4,6 +4,11 @@
terraform and terraform-libvirt provider
+# Terraform Host
+
+mkisofs and libvirt are needed on the machine where terraform is running for
+these plans to run properly.
+
# Usage
You need to have a `node.tfvars` in the `nodes/` directory which has contents
@@ -28,9 +33,3 @@
make apply NODE=node1
```
-
-# Terraform Host
-
-mkisofs is needed on the machine where terraform is running from to be able to
-create cloudinit isos.
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common.tf Wed Feb 06 23:09:17 2019 -0600
@@ -0,0 +1,1 @@
+variable "admin_ssh_pubkey" {}
--- a/instance-registry-cache.tf Wed Feb 06 19:53:43 2019 -0600
+++ b/instance-registry-cache.tf Wed Feb 06 23:09:17 2019 -0600
@@ -2,13 +2,13 @@
variable "registry_cache_memory" { default="1024" } # 1gb
variable "registry_cache_cpu" { default="1" }
-variable "admin_ssh_pubkey" {}
-
resource "libvirt_volume" "registry_cache" {
name = "registry-cache-root"
- base_volume_id = "${libvirt_volume.debian_base.id}"
+
format = "qcow2"
+ base_volume_id = "${libvirt_volume.debian_base.id}"
size = "${var.registry_cache_disk_size}"
+ pool = "${var.volume_pool}"
}
data "template_file" "registry_cache_user_data" {
@@ -36,6 +36,7 @@
resource "libvirt_domain" "registry_cache" {
name = "registry-cache"
+
memory = "${var.registry_cache_memory}"
vcpu = "${var.registry_cache_cpu}"
autostart = true
@@ -48,22 +49,10 @@
target_type = "serial"
}
-# console {
-# type = "pty"
-# target_port = "1"
-# target_type = "virtio"
-# }
-
disk {
volume_id = "${libvirt_volume.registry_cache.id}"
}
-# graphics {
-# type = "spice"
-# listen_type = "address"
-# autoport = true
-# }
-
network_interface {
network_name = "default"
wait_for_lease = true
--- a/instance-worker.tf Wed Feb 06 19:53:43 2019 -0600
+++ b/instance-worker.tf Wed Feb 06 23:09:17 2019 -0600
@@ -5,15 +5,17 @@
resource "libvirt_volume" "worker" {
count = "${var.worker_count}"
+
name = "worker-${count.index}-root"
format = "qcow2"
base_volume_id = "${libvirt_volume.debian_base.id}"
size = "${var.worker_disk_size}"
+ pool = "${var.volume_pool}"
}
data "template_file" "worker_user_data" {
- count = "${var.worker_count > 0 ? 1 : 0}"
+ count = "${var.worker_count > 0 ? var.worker_count : 0}"
template = <<EOF
#cloud-config
@@ -38,7 +40,7 @@
count = "${var.worker_count}"
name = "worker-${count.index}-init.iso"
- user_data = "${data.template_file.worker_user_data.rendered}"
+ user_data = "${element(data.template_file.worker_user_data.*.rendered, count.index)}"
}
resource "libvirt_domain" "worker" {
@@ -51,28 +53,16 @@
cloudinit = "${element(libvirt_cloudinit_disk.worker.*.id, count.index)}"
-# console {
-# type = "pty"
-# target_port = "0"
-# target_type = "serial"
-# }
-
-# console {
-# type = "pty"
-# target_port = "1"
-# target_type = "virtio"
-# }
+ console {
+ type = "pty"
+ target_port = "0"
+ target_type = "serial"
+ }
disk {
volume_id = "${element(libvirt_volume.worker.*.id, count.index)}"
}
-# graphics {
-# type = "spice"
-# listen_type = "address"
-# autoport = true
-# }
-
network_interface {
network_name = "default"
wait_for_lease = true
--- a/volume-base.tf Wed Feb 06 19:53:43 2019 -0600
+++ b/volume-base.tf Wed Feb 06 23:09:17 2019 -0600
@@ -1,7 +1,12 @@
+variable "volume_pool" { default = "default" }
+
+variable "base_image_url" { default = "https://cdimage.debian.org/cdimage/openstack/9.7.0/debian-9.7.0-openstack-amd64.qcow2" }
+
+
resource "libvirt_volume" "debian_base" {
name = "debian-base"
- pool = "default"
- source = "https://cdimage.debian.org/cdimage/openstack/9.6.2-20181228/debian-9.6.2-20181228-openstack-amd64.qcow2"
+ pool = "${var.volume_pool}"
+ source = "${var.base_image_url}"
format = "qcow2"
}