From e9514b089325a286179406268ca22fb2a18dbff2 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Wed, 5 Jul 2023 15:58:06 +0100 Subject: [PATCH] further fine tuning --- openstack/init/01-images.tf | 23 +++++++++++++++++++++++ openstack/init/01-main.tf | 8 -------- openstack/init/05-instance.tf | 7 +------ 3 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 openstack/init/01-images.tf diff --git a/openstack/init/01-images.tf b/openstack/init/01-images.tf new file mode 100644 index 0000000..f9f8e04 --- /dev/null +++ b/openstack/init/01-images.tf @@ -0,0 +1,23 @@ +resource "openstack_images_image_v2" "cirros" { + name = "cirros" + local_file_path = "/home/arif/images/cirros-0.5.1-x86_64-disk.img" + container_format = "bare" + disk_format = "qcow2" + visibility = "public" +} + +resource "openstack_images_image_v2" "bionic-raw" { + name = "bionic-raw" + local_file_path = "/home/arif/images/bionic-server-cloudimg-amd64-raw.img" + container_format = "bare" + disk_format = "raw" + visibility = "public" +} + +resource "openstack_images_image_v2" "focal-raw" { + name = "focal-raw" + local_file_path = "/home/arif/images/focal-server-cloudimg-amd64-raw.img" + container_format = "bare" + disk_format = "raw" + visibility = "public" +} diff --git a/openstack/init/01-main.tf b/openstack/init/01-main.tf index 871bd09..ff7f068 100644 --- a/openstack/init/01-main.tf +++ b/openstack/init/01-main.tf @@ -40,11 +40,3 @@ resource "openstack_compute_secgroup_v2" "allow_ping" { cidr = "0.0.0.0/0" } } - -resource "openstack_images_image_v2" "cirros" { - name = "cirros" - local_file_path = "/home/arif/images/cirros-0.5.1-x86_64-disk.img" - container_format = "bare" - disk_format = "qcow2" - visibility = "public" -} diff --git a/openstack/init/05-instance.tf b/openstack/init/05-instance.tf index f8ea8c2..38b2ac6 100644 --- a/openstack/init/05-instance.tf +++ b/openstack/init/05-instance.tf @@ -2,11 +2,6 @@ data "openstack_compute_flavor_v2" "m1_small" { name = "m1.small" } -data "openstack_images_image_v2" "bionic-raw" { - name = "bionic-raw" - most_recent = true -} - resource "openstack_compute_instance_v2" "test_server_01" { name = "test_server_01" flavor_id = data.openstack_compute_flavor_v2.m1_small.id @@ -14,7 +9,7 @@ resource "openstack_compute_instance_v2" "test_server_01" { security_groups = ["default"] block_device { - uuid = data.openstack_images_image_v2.bionic-raw.id + uuid = openstack_images_image_v2.bionic-raw.id source_type = "image" volume_size = 10 boot_index = 0