From b16912fa0a06594e587a17d75f9f60b212f7d307 Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Thu, 4 Dec 2025 12:47:45 +0000 Subject: [PATCH 1/2] fix(iac): Support custom image UUID override to handle deactivated openstack images --- .../modules/openstack-cogstack-infra/compute.tf | 2 +- .../modules/openstack-cogstack-infra/outputs.tf | 2 +- .../openstack-cogstack-infra/shared-locals.tf | 2 +- .../openstack-cogstack-infra/variables.tf | 16 +++++++++------- .../openstack-kubernetes-infra/compute.tf | 7 +++---- .../kubeconfig-extraction.tf | 6 +++--- .../openstack-kubernetes-infra/variables.tf | 4 +++- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/deployment/terraform/modules/openstack-cogstack-infra/compute.tf b/deployment/terraform/modules/openstack-cogstack-infra/compute.tf index 9b2b31f..0ab8c89 100644 --- a/deployment/terraform/modules/openstack-cogstack-infra/compute.tf +++ b/deployment/terraform/modules/openstack-cogstack-infra/compute.tf @@ -17,7 +17,7 @@ resource "openstack_compute_instance_v2" "cogstack_ops_compute" { } block_device { - uuid = data.openstack_images_image_v2.ubuntu.id + uuid = each.value.image_uuid == null ? data.openstack_images_image_v2.ubuntu.id : each.value.image_uuid source_type = "image" volume_size = each.value.volume_size boot_index = 0 diff --git a/deployment/terraform/modules/openstack-cogstack-infra/outputs.tf b/deployment/terraform/modules/openstack-cogstack-infra/outputs.tf index 65605c1..57aa040 100644 --- a/deployment/terraform/modules/openstack-cogstack-infra/outputs.tf +++ b/deployment/terraform/modules/openstack-cogstack-infra/outputs.tf @@ -22,7 +22,7 @@ output "compute_keypair" { } output "created_security_group" { - value = openstack_networking_secgroup_v2.cogstack_apps_security_group + value = openstack_networking_secgroup_v2.cogstack_apps_security_group description = "Security group associated to the created hosts" } diff --git a/deployment/terraform/modules/openstack-cogstack-infra/shared-locals.tf b/deployment/terraform/modules/openstack-cogstack-infra/shared-locals.tf index f6ffc63..9106870 100644 --- a/deployment/terraform/modules/openstack-cogstack-infra/shared-locals.tf +++ b/deployment/terraform/modules/openstack-cogstack-infra/shared-locals.tf @@ -1,6 +1,6 @@ locals { - random_prefix = random_id.server.b64_url + random_prefix = random_id.server.b64_url output_file_directory = var.output_file_directory != null ? var.output_file_directory : "${path.root}/.build" } diff --git a/deployment/terraform/modules/openstack-cogstack-infra/variables.tf b/deployment/terraform/modules/openstack-cogstack-infra/variables.tf index ecdddc6..3b0f74d 100644 --- a/deployment/terraform/modules/openstack-cogstack-infra/variables.tf +++ b/deployment/terraform/modules/openstack-cogstack-infra/variables.tf @@ -29,12 +29,14 @@ name = Human readable hostname for this host. is_controller = Must be true for exactly one host. This will run the portainer "controller". All other nodes run the portainer "agent". flavour = The openstack_compute_flavor_v2 for the host volume_size = Size in GB for the disk volume for the node +image_uuid = (Optional) The Openstack image you want to run, to override the default in ubuntu_immage_name EOT type = list(object({ name = string, flavour = optional(string, "2cpu4ram"), volume_size = optional(number, 20), - is_controller = optional(bool, false) + is_controller = optional(bool, false), + image_uuid = optional(string, null) })) default = [ @@ -70,11 +72,11 @@ EOT variable "allowed_security_group_rules" { type = list(object({ - port = number - cidr = string - description = string + port = number + cidr = string + description = string })) - default = [ ] + default = [] description = < Date: Thu, 4 Dec 2025 12:50:04 +0000 Subject: [PATCH 2/2] fix(iac): Support custom image UUID override to handle deactivated openstack images --- .../terraform/modules/openstack-kubernetes-infra/compute.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf b/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf index 1a909d2..b5a5551 100644 --- a/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf +++ b/deployment/terraform/modules/openstack-kubernetes-infra/compute.tf @@ -54,8 +54,7 @@ resource "openstack_compute_instance_v2" "kubernetes_nodes" { } block_device { - # uuid = var.ubuntu_immage_name - uuid = "4491629f-94fb-41ec-9da7-fe9bc21f9f1a" + uuid = each.value.image_uuid == null ? data.openstack_images_image_v2.ubuntu.id : each.value.image_uuid source_type = "image" volume_size = each.value.volume_size boot_index = 0