cli: use pre-uploaded image on OpenStack

Before, the terraform infrastructure code would upload an image on the fly.
Now, we upload images in advance and specify the image ID instead.
This commit is contained in:
Malte Poll 2024-02-19 13:33:47 +01:00
parent 3b2da12781
commit 6f9020d527
8 changed files with 22 additions and 56 deletions

View file

@ -55,19 +55,6 @@ resource "random_password" "init_secret" {
override_special = "_%@"
}
resource "openstack_images_image_v2" "image_id" {
name = local.name
image_source_url = var.image_id
web_download = var.direct_download
container_format = "bare"
disk_format = "raw"
visibility = "private"
properties = {
hw_firmware_type = "uefi"
os_type = "linux"
}
}
data "openstack_networking_network_v2" "floating_ip_pool" {
network_id = var.floating_ip_pool_id
}
@ -216,7 +203,7 @@ module "instance_group" {
disk_size = each.value.state_disk_size
state_disk_type = each.value.state_disk_type
availability_zone = each.value.zone
image_id = openstack_images_image_v2.image_id.image_id
image_id = var.image_id
flavor_id = each.value.flavor_id
security_groups = [openstack_networking_secgroup_v2.vpc_secgroup.id]
tags = local.tags

View file

@ -25,7 +25,7 @@ variable "node_groups" {
variable "image_id" {
type = string
description = "OS image URL for the cluster's nodes."
description = "OS image ID for the cluster's nodes."
}
variable "debug" {
@ -48,11 +48,6 @@ variable "cloud" {
description = "Cloud to use within the OpenStack \"clouds.yaml\" file. Optional. If not set, environment variables are used."
}
variable "direct_download" {
type = bool
description = "Download OS image directly from source URL to OpenStack. Otherwise, the image is downloaded to the local machine and uploads to OpenStack."
}
variable "floating_ip_pool_id" {
type = string
description = "Pool (network name) to use for floating IPs."