From 9d73c80ab9ed2f18378d9905e47868d63c83ae96 Mon Sep 17 00:00:00 2001 From: Maria Seralessandri Date: Wed, 24 Jun 2026 16:07:04 +0200 Subject: [PATCH 1/4] demos/terraform: Rename network resource from microbr0 to microbr Signed-off-by: Maria Seralessandri --- demos/terraform/main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demos/terraform/main.tf b/demos/terraform/main.tf index 503169cee..d248cbdd7 100644 --- a/demos/terraform/main.tf +++ b/demos/terraform/main.tf @@ -45,7 +45,7 @@ locals { } } -resource "lxd_network" "microbr0" { +resource "lxd_network" "microbr" { name = var.network_name config = { @@ -123,7 +123,7 @@ resource "lxd_instance" "microcloud" { type = "nic" properties = { nictype = "bridged" - parent = lxd_network.microbr0.name + parent = lxd_network.microbr.name } } @@ -204,7 +204,7 @@ resource "lxd_instance" "microcloud" { depends_on = [ data.lxd_network.lookup_bridge, - lxd_network.microbr0, + lxd_network.microbr, lxd_volume.local_disk, lxd_volume.ceph_disk ] From 2a41f1aaa1c088a3422fb55c95517ff6ee17b8cc Mon Sep 17 00:00:00 2001 From: Maria Seralessandri Date: Wed, 24 Jun 2026 16:07:33 +0200 Subject: [PATCH 2/4] demos/terraform: Simplify disk numbering in main.tf Signed-off-by: Maria Seralessandri --- demos/terraform/main.tf | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/demos/terraform/main.tf b/demos/terraform/main.tf index d248cbdd7..25dc7a43a 100644 --- a/demos/terraform/main.tf +++ b/demos/terraform/main.tf @@ -32,17 +32,14 @@ locals { systems = [ for i, name in var.vm_names : { - name = name - ip = cidrhost(local.lookup_subnet, var.ip_base_offset + (i * var.ip_increment)) - has_ceph = contains(var.ceph_nodes, name) + name = name + ip = cidrhost(local.lookup_subnet, var.ip_base_offset + (i * var.ip_increment)) + has_ceph = contains(var.ceph_nodes, name) + disk_number = var.disk_number_start + i } ] - ceph_disk_mapping = { - for i, system in local.systems : i => length([ - for j, s in local.systems : j if j < i && s.has_ceph - ]) if system.has_ceph - } + ceph_systems = [for s in local.systems : s if s.has_ceph] } resource "lxd_network" "microbr" { @@ -57,8 +54,8 @@ resource "lxd_network" "microbr" { } resource "lxd_volume" "local_disk" { - count = var.vm_count - name = "${var.local_disk_name_prefix}${count.index + 1}" + count = length(local.systems) + name = "${var.local_disk_name_prefix}${local.systems[count.index].disk_number}" pool = var.storage_pool type = "custom" content_type = "block" @@ -68,8 +65,8 @@ resource "lxd_volume" "local_disk" { } resource "lxd_volume" "ceph_disk" { - count = length([for system in local.systems : system if system.has_ceph]) - name = "${var.ceph_disk_name_prefix}${count.index + 1}" + count = length(local.ceph_systems) + name = "${var.ceph_disk_name_prefix}${local.ceph_systems[count.index].disk_number}" pool = var.storage_pool type = "custom" content_type = "block" @@ -79,7 +76,7 @@ resource "lxd_volume" "ceph_disk" { } resource "lxd_instance" "microcloud" { - count = var.vm_count + count = length(local.systems) name = var.vm_names[count.index] image = var.ubuntu_image type = "virtual-machine" @@ -90,7 +87,6 @@ resource "lxd_instance" "microcloud" { } config = { - "security.secureboot" = "false" "cloud-init.user-data" = templatefile("${path.module}/cloud-init.yaml.tpl", { hostname = var.vm_names[count.index] lookup_interface = var.lookup_interface @@ -143,7 +139,7 @@ resource "lxd_instance" "microcloud" { type = "disk" properties = { pool = var.storage_pool - source = lxd_volume.ceph_disk[local.ceph_disk_mapping[count.index]].name + source = lxd_volume.ceph_disk[index(local.ceph_systems[*].name, local.systems[count.index].name)].name } } } From 02f4bcaa5b45c8409337bf253dafe6df5b947352 Mon Sep 17 00:00:00 2001 From: Maria Seralessandri Date: Wed, 24 Jun 2026 16:08:13 +0200 Subject: [PATCH 3/4] demos/terraform: Add disk_number_start variable in variables.tf Signed-off-by: Maria Seralessandri --- demos/terraform/variables.tf | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/demos/terraform/variables.tf b/demos/terraform/variables.tf index 9525e96c0..662ae46ec 100644 --- a/demos/terraform/variables.tf +++ b/demos/terraform/variables.tf @@ -148,13 +148,6 @@ variable "lookup_bridge" { default = "lxdbr0" } - -variable "vm_count" { - description = "Number of VMs to create" - type = number - default = 4 -} - variable "ip_base_offset" { description = "Base IP address offset for the first VM" type = number @@ -179,6 +172,12 @@ variable "ceph_disk_name_prefix" { default = "remote" } +variable "disk_number_start" { + description = "Starting number for disk names (e.g., 1 for local1/remote1, 5 for local5/remote5)" + type = number + default = 1 +} + variable "initiator" { description = "Name of the initiator node for MicroCloud cluster (matches preseed initiator)" type = string From 648bfde2d21d64ce849fb0fa66d42c4a3aed7342 Mon Sep 17 00:00:00 2001 From: Maria Seralessandri Date: Wed, 24 Jun 2026 16:08:28 +0200 Subject: [PATCH 4/4] demos/terraform: Add disk_number_start in terraform.tfvars.example Signed-off-by: Maria Seralessandri --- demos/terraform/terraform.tfvars.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/terraform/terraform.tfvars.example b/demos/terraform/terraform.tfvars.example index a82a4bd6a..f8f58427d 100644 --- a/demos/terraform/terraform.tfvars.example +++ b/demos/terraform/terraform.tfvars.example @@ -22,7 +22,6 @@ lookup_timeout = 300 instance_create_timeout = "25m" # VM Configuration -vm_count = 4 vm_names = ["micro1", "micro2", "micro3", "micro4"] ceph_nodes = ["micro1", "micro2", "micro3"] @@ -46,6 +45,7 @@ ip_increment = 10 # Disk Name Configuration local_disk_name_prefix = "local" ceph_disk_name_prefix = "remote" +disk_number_start = 1 # MicroCloud Configuration initiator = "micro1"