From 9abb0b010ed91c8929aa9b6b7c7c4addaafd4978 Mon Sep 17 00:00:00 2001 From: James Allenby Date: Fri, 14 Aug 2026 22:08:45 +0100 Subject: [PATCH] feat: add variable master and worker counts --- infra/main.tofu | 10 +++------- infra/variables.tofu | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/infra/main.tofu b/infra/main.tofu index 2f0d44d..a117fb3 100644 --- a/infra/main.tofu +++ b/infra/main.tofu @@ -3,14 +3,10 @@ # ------ locals { + image = "ubuntu/26.04" root_disk_size = "16GiB" ext_disk_size = "16GiB" network_cidr = "10.150.0.1/24" - - master_count = 3 - worker_count = 0 - - image = "ubuntu/26.04" } # --------- @@ -46,7 +42,7 @@ resource "incus_network" "this" { module "master" { source = "./modules/incus_vm" - count = local.master_count + count = var.master_count name = "master-${count.index}" project = incus_project.this.name @@ -60,7 +56,7 @@ module "master" { module "worker" { source = "./modules/incus_vm" - count = local.worker_count + count = var.worker_count name = "worker-${count.index}" project = incus_project.this.name diff --git a/infra/variables.tofu b/infra/variables.tofu index 6bfeac1..161ca9f 100644 --- a/infra/variables.tofu +++ b/infra/variables.tofu @@ -1,3 +1,17 @@ +variable "master_count" { + description = "The number of master nodes to provision." + type = number + default = 1 + nullable = false +} + +variable "worker_count" { + description = "The number of worker nodes to provision." + type = number + default = 0 + nullable = false +} + variable "cpus" { description = "The number of CPU cores allocated to each virtual machine." type = number