diff --git a/example.tfvars b/example.tfvars index 4ea7b3c..df3f604 100644 --- a/example.tfvars +++ b/example.tfvars @@ -7,9 +7,6 @@ admin-ips = [ "8.8.8.8/32", "0.0.0.0/0" ] disk-image-dir = "/path/to/disk/pool/" libvirt-connection-url = "qemu+ssh://@/system" -master-nodes = 1 -worker-nodes = 2 - node-memory = 2048 node-vcpus = 2 diff --git a/main.tf b/main.tf index ce42da9..7510f3e 100644 --- a/main.tf +++ b/main.tf @@ -84,32 +84,19 @@ module "nodes" { # uri = var.libvirt-connection-url # } # -# module "master-nodes" { +# module "nodes" { +# for_each = var.nodes-config # source = "./modules/libvirt-nodes" # pool-name = libvirt_pool.images.name -# name-prefix = "${var.vm-name-prefix}-master" -# num-nodes = var.master-nodes +# name-prefix = "${var.vm-name-prefix}-${each.key}" +# num-nodes = each.value.num # node-memory = var.node-memory # node-vcpus = var.node-vcpus -# base-image = var.base-image +# base-image = each.value.base-image # root-admin-passwd = var.root-admin-passwd # root-admin-pub-key = var.root-admin-pub-key # libvirt-connection-url = var.libvirt-connection-url -# user-datas = data.template_file.master-node-user-datas -# } -# -# module "worker-nodes" { -# source = "./modules/libvirt-nodes" -# pool-name = libvirt_pool.images.name -# name-prefix = "${var.vm-name-prefix}-worker" -# num-nodes = var.worker-nodes -# node-memory = var.node-memory -# node-vcpus = var.node-vcpus -# base-image = var.base-image -# root-admin-passwd = var.root-admin-passwd -# root-admin-pub-key = var.root-admin-pub-key -# libvirt-connection-url = var.libvirt-connection-url -# user-datas = data.template_file.worker-node-user-datas +# user-datas = lookup(module.cloud-init-config, each.key, null).user-datas # } # # resource "libvirt_pool" "images" { diff --git a/modules/libvirt-nodes/main.tf b/modules/libvirt-nodes/main.tf index 9b792d0..cbd0dac 100644 --- a/modules/libvirt-nodes/main.tf +++ b/modules/libvirt-nodes/main.tf @@ -8,10 +8,6 @@ terraform { } } -provider "libvirt" { - uri = var.libvirt-connection-url -} - resource "libvirt_volume" "node-images" { name = "${var.name-prefix}-${count.index}" pool = var.pool-name