From acfea89bcbd640d4973d60ac8225b625688a68b1 Mon Sep 17 00:00:00 2001 From: Anthony Delannoy Date: Thu, 1 Aug 2024 14:49:11 +0200 Subject: [PATCH] chore(openstack): add OVHcloud example --- openstack/compute.tf | 10 +-------- openstack/image.tf | 49 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 openstack/image.tf diff --git a/openstack/compute.tf b/openstack/compute.tf index d005f4d..8b73d7f 100644 --- a/openstack/compute.tf +++ b/openstack/compute.tf @@ -23,20 +23,12 @@ data "openstack_compute_flavor_v2" "flatcar" { name = var.flavor_name } -# We create the OpenStack image by importing directly from the release servers. -resource "openstack_images_image_v2" "flatcar" { - name = "${var.cluster_name}-${var.release_channel}" - image_source_url = "https://${var.release_channel}.release.flatcar-linux.net/amd64-usr/${var.flatcar_version}/flatcar_production_openstack_image.img.gz" - container_format = "bare" - disk_format = "qcow2" - web_download = true -} - # 'instance' are the OpenStack instances created from the 'flatcar' image # using user data. resource "openstack_compute_instance_v2" "instance" { for_each = toset(var.machines) name = "${var.cluster_name}-${each.key}" + # XXX See flatcar_ovhcloud if you work on OVHcloud provider image_id = openstack_images_image_v2.flatcar.id flavor_id = data.openstack_compute_flavor_v2.flatcar.id key_pair = openstack_compute_keypair_v2.provisioning_keypair.name diff --git a/openstack/image.tf b/openstack/image.tf new file mode 100644 index 0000000..9ac3de1 --- /dev/null +++ b/openstack/image.tf @@ -0,0 +1,49 @@ +# We create the OpenStack image by importing directly from the release servers. +resource "openstack_images_image_v2" "flatcar" { + name = "${var.cluster_name}-${var.release_channel}" + image_source_url = "https://${var.release_channel}.release.flatcar-linux.net/amd64-usr/${var.flatcar_version}/flatcar_production_openstack_image.img.gz" + container_format = "bare" + disk_format = "qcow2" + web_download = true +} + +# OVHcloud version, not supporting web_download + specify properties (notably +# for block-storage to avoid using virtio-blk instead of SCSI) +resource "openstack_images_image_v2" "flatcar_ovhcloud" { + name = "${var.cluster_name}-${var.release_channel}.${var.flatcar_version}" + image_source_url = "https://${var.release_channel}.release.flatcar-linux.net/amd64-usr/${var.flatcar_version}/flatcar_production_openstack_image.img.gz" + # XXX do not use it, OVH openstack seems to not handle this well :( + # web_download = false + verify_checksum = true + decompress = true + container_format = "bare" + disk_format = "qcow2" + protected = false + # Use hidden for image retirement/promotion + hidden = false + visibility = "private" + + # See: https://docs.openstack.org/glance/stein/admin/useful-image-properties.html + # See: https://wiki.openstack.org/wiki/VirtDriverImageProperties + properties = { + architecture = "x86_64" + image_original_user = "core" + distro_family = "gentoo" + os_distro = "gentoo" + os_version = var.flatcar_version + os_release_channel = var.release_channel + os_arch = "amd64" + os_type = "linux" + hw_disk_bus = "scsi" + hw_scsi_model = "virtio-scsi" + hypervisor_type = "qemu" + hw_qemu_guest_agent = true + hw_vif_model = "virtio" + hw_vif_multiqueue_enabled = true + hw_time_hpet = true + } + + timeouts { + create = "5m" + } +}