From 1dd83a04695140c6691fbb19198d9757774abe39 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 28 Nov 2023 11:30:47 +0100 Subject: [PATCH] Using local.geoserver_instances to create the geoserver instances with specific properties --- .gitignore | 1 - .../d4s-dev/geoserver/geoserver_plan.zip | Bin 0 -> 11206 bytes .../modules/common_variables/variables.tf | 16 +++++ openstack-tf/modules/geoserver/geoserver.tf | 60 ++++++++++++++++-- .../instances/geoserver-geoportal.tfvars | 12 ---- .../modules/geoserver/variables-geoserver.tf | 13 ++++ 6 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 openstack-tf/d4s-dev/geoserver/geoserver_plan.zip delete mode 100644 openstack-tf/modules/geoserver/instances/geoserver-geoportal.tfvars diff --git a/.gitignore b/.gitignore index c31df9c..09277b0 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ crash.*.log *.tfvars *.tfvars.json !*.auto.tfvars -!geoserver*.tfvars # Ignore override files as they are usually used to override resources locally and so # are not checked in override.tf diff --git a/openstack-tf/d4s-dev/geoserver/geoserver_plan.zip b/openstack-tf/d4s-dev/geoserver/geoserver_plan.zip new file mode 100644 index 0000000000000000000000000000000000000000..c5e987ef5182af45477f388f0190ce144ee06988 GIT binary patch literal 11206 zcmb7q1yCH_()Qv`a0?{3FYfNa-QC^YEl6;O;I6?nxVyWAg&@J*0|7pAZ{7DzQun@p z{XMn2HC;2$^z7-=&*|TDLE1m0j_77KOy*{$%3Sxu zg<-0|9JRpw&?y2T4FF8zaN`?o9=)!Fvlmt9sk(=OrTjsDs)Ye{pC|erGSpBaEYE~H z*+ejQYx)z2%*^cO!FzY(a+)r*u9MAgcM%;o{cCit;05d30HpU!GkW^5C^<%kKpYN+ zWz?8;D#O>rBmOJM(v9Bib?aHF?QCvl0}m<8{MTb3m`Jb&3&B2Q-mDlw7##AF*G1j; zBLEWjy>ss}LlLAALd6Hk_xgjXh&Jvyf@NsErqE)&azx-R=+ro=(1Gv)b2wcaw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z^Zxt18vm-VC(;klD7)QDB&c{^$^JI_&b#LE-swy6mt7NSlSQJ`x^ey2Z=&!C@Q77P zB)jLN!Adk4)ag0z`_@*)H^aecVRuY>kf_0>Q3Ex(`XTq{BEHeeL&*pspu58+R#t$e zJS$Xa<<*JHI_al$q3u{#a83&JREbwAU8(E2!w-tDKZ{&bz>!2Tm50FdbuS~ImdDS zYDhT+Lk)|J#27tDPfCUJ zKm17fgb~Mh?4ke6r$oh1q~IU&s6EPv<3Bo=4B0YLNo{2`=wqb{k{}v#ef?ZyjwWu8 z4CH}{2;;=W zp`dh7(lsmz`Y`j_$?AO-WzyF&v9Ww?=yb_gBg%2}I$2tIE6q>`53%?JFM&@bSUr1; zRg|w{6?oFg&yHAF(mB!DU(r(!qb2${f{~x(o20wApT>R&bQFamTgqWT8`IT@OE8#A zPU;J;pEkxFA}AN^`^IGMNUu_g^vpB=HocSW`L8P0072RW(MyX;?q7`rFmMdO-`fIz zZCL%>7WljTu}M%~>i3&}?NI#eY5gt!FI@p=)89K>f8PCTzu;#V<8K*z_1E3M_cZ>5 z__b>KGe!7Yyk7#1v+4h%&G0AOul2^Ck>_t|M*kh|&%*1UNWT^if7U1emWda}`PH!h zR;~OK?bjswXR+~bk;D8Q?XSG(&(hLtnf3P}sm1>v zz`ye5pK!lY+D|(ETPR6>gZuv>=RY6vD;ND_$G_$2w}<>UuKW}0*U9#~50#Mu{*lY% WrJ!C`Bme;7%aQ&vT`?(tp8X%fhTymW literal 0 HcmV?d00001 diff --git a/openstack-tf/modules/common_variables/variables.tf b/openstack-tf/modules/common_variables/variables.tf index 7ed8c05..42aea9a 100644 --- a/openstack-tf/modules/common_variables/variables.tf +++ b/openstack-tf/modules/common_variables/variables.tf @@ -205,3 +205,19 @@ variable "smartexecutor_addresses" { module "ssh_settings" { source = "../../modules/ssh-key-ref" } + +# Added by Francesco +variable "flavor_list" { + type = map(string) + default = { + c1_small = "c1.small" #RAM 2 - VCPUs 2 + c1_medium = "c1.medium" #RAM 4 - VCPUs 4 + c1_large = "c1.large" #RAM 8 - VCPUs 8 + m1_medium = "m1.medium" #RAM 4 - VCPUs 2 + m1_large = "m1.large" #RAM 8 - VCPUs 4 + m1_xlarge = "m1.xlarge" #RAM 16 - VCPUs 8 + m2_small = "m2.small" #RAM 8 - VCPUs 2 + m2_medium = "m2.medium" #RAM 16 - VCPUs 4 + m2_large = "m2.large" #RAM 32 - VCPUs 8 + } +} diff --git a/openstack-tf/modules/geoserver/geoserver.tf b/openstack-tf/modules/geoserver/geoserver.tf index 45dff34..4d883c9 100644 --- a/openstack-tf/modules/geoserver/geoserver.tf +++ b/openstack-tf/modules/geoserver/geoserver.tf @@ -1,15 +1,60 @@ +# Creates single geoserver instance + +# # Geoserver attached volume - used for 'geoserver_data' +# resource "openstack_blockstorage_volume_v3" "geoserver_data_vol" { +# name = var.geoserver_basic_data.vol_data_name +# size = var.geoserver_basic_data.vol_data_size +# } + +# # Geoserver instance +# resource "openstack_compute_instance_v2" "geoserver" { +# name = var.geoserver_basic.name +# availability_zone_hints = var.availability_zones_names.availability_zone_no_gpu +# flavor_name = var.geoserver_basic.flavor +# key_pair = module.ssh_settings.ssh_key_name +# security_groups = [var.security_group_list.default, var.security_group_list.http_and_https_from_the_load_balancers] +# block_device { +# uuid = var.ubuntu_1804.uuid +# source_type = "image" +# volume_size = 10 +# boot_index = 0 +# destination_type = "volume" +# delete_on_termination = false +# } +# network { +# name = var.main_private_network.name +# } +# network { +# name = var.shared_postgresql_server_data.network_name +# } +# user_data = file("${var.ubuntu1804_data_file}") +# } + + +# # Attach the additional volume +# resource "openstack_compute_volume_attach_v2" "geoserver_data_attach_vol" { +# instance_id = openstack_compute_instance_v2.geoserver.id +# volume_id = openstack_blockstorage_volume_v3.geoserver_data_vol.id +# device = var.geoserver_basic_data.vol_data_device +# depends_on = [openstack_compute_instance_v2.geoserver] +# } + + +# Creates all the geoserver instances with volumes declared in the locals.geoserver_instances # Geoserver attached volume - used for 'geoserver_data' -resource "openstack_blockstorage_volume_v3" "geoserver_data_vol" { - name = var.geoserver_basic_data.vol_data_name - size = var.geoserver_basic_data.vol_data_size +resource "openstack_blockstorage_volume_v3" "geoserver_data_volume" { + for_each = local.geoserver_instances + name = each.value.vol_data_name + size = each.value.vol_data_size } # Geoserver instance resource "openstack_compute_instance_v2" "geoserver" { - name = var.geoserver_basic.name + for_each = local.geoserver_instances + name = each.value.name availability_zone_hints = var.availability_zones_names.availability_zone_no_gpu - flavor_name = var.geoserver_basic.flavor + flavor_name = each.value.flavor key_pair = module.ssh_settings.ssh_key_name security_groups = [var.security_group_list.default, var.security_group_list.http_and_https_from_the_load_balancers] block_device { @@ -32,8 +77,9 @@ resource "openstack_compute_instance_v2" "geoserver" { # Attach the additional volume resource "openstack_compute_volume_attach_v2" "geoserver_data_attach_vol" { - instance_id = openstack_compute_instance_v2.geoserver.id - volume_id = openstack_blockstorage_volume_v3.geoserver_data_vol.id + for_each = local.geoserver_instances + instance_id = openstack_compute_instance_v2.geoserver[each.key].id + volume_id = openstack_blockstorage_volume_v3.geoserver_data_volume[each.key].id device = var.geoserver_basic_data.vol_data_device depends_on = [openstack_compute_instance_v2.geoserver] } diff --git a/openstack-tf/modules/geoserver/instances/geoserver-geoportal.tfvars b/openstack-tf/modules/geoserver/instances/geoserver-geoportal.tfvars deleted file mode 100644 index 5cacfe1..0000000 --- a/openstack-tf/modules/geoserver/instances/geoserver-geoportal.tfvars +++ /dev/null @@ -1,12 +0,0 @@ - -geoserver_basic = { - name = "geoserver-geoportal" - description = "Geoserver geoportal instance" - flavor = "c1.medium" -} - -geoserver_basic_data = { - vol_data_name = "geoserver_data_volume" - vol_data_size = "40" - vol_data_device = "/dev/vdb" -} diff --git a/openstack-tf/modules/geoserver/variables-geoserver.tf b/openstack-tf/modules/geoserver/variables-geoserver.tf index a685d92..c437ae1 100644 --- a/openstack-tf/modules/geoserver/variables-geoserver.tf +++ b/openstack-tf/modules/geoserver/variables-geoserver.tf @@ -15,3 +15,16 @@ variable "geoserver_basic_data" { vol_data_device = "/dev/vdb" } } + +locals { + geoserver_instances = { + "geona" = { name = "geoserver-geona", description = "Geoserver geona instance", flavor = var.flavor_list.m1_xlarge, vol_data_name = "geoserver-geona_data_volume", vol_data_size = "50" }, + "esquiline" = { name = "geoserver-esquiline", description = "Geoserver esquiline instance", flavor = var.flavor_list.m2_small, vol_data_name = "geoserver-esquiline_data_volume", vol_data_size = "20" }, + "grsf" = { name = "geoserver-grsf", description = "Geoserver grsf instance", flavor = var.flavor_list.m1_large, vol_data_name = "geoserver-grsf_data_volume", vol_data_size = "40" }, + "protectedareaimpactmaps" = { name = "geoserver-protectedareaimpactmaps", description = "Geoserver protectedareaimpactmaps instance", flavor = var.flavor_list.c1_large, vol_data_name = "geoserver-protectedareaimpactmaps_data_volume", vol_data_size = "70" }, + "sdi-lab" = { name = "geoserver-sdi-lab", description = "Geoserver sdi-lab instance", flavor = var.flavor_list.m1_large, vol_data_name = "geoserver-sdi-lab_data_volume", vol_data_size = "100" }, + "tunaatlas" = { name = "geoserver-tunaatlas", description = "Geoserver tunaatlas instance", flavor = var.flavor_list.m1_large, vol_data_name = "geoserver-tunaatlas_data_volume", vol_data_size = "60" }, + "wecafc-firms" = { name = "geoserver-wecafc-firms", description = "Geoserver wecafc-firms instance", flavor = var.flavor_list.m1_large, vol_data_name = "geoserver-wecafc-firms_data_volume", vol_data_size = "40" }, + "aquacultureatlas" = { name = "geoserver-aquacultureatlas", description = "Geoserver aquacultureatlas instance", flavor = var.flavor_list.m1_large, vol_data_name = "geoserver-aquacultureatlas_data_volume", vol_data_size = "50" } + } +}