From 62cbe65b5fd90088aa59483528aa0dab1e120c5b Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 13 Dec 2023 15:05:37 +0100 Subject: [PATCH] Updated GeoServer Terraform plan --- openstack-tf/d4s-dev/geoserver/main.tf | 137 ++------------ .../d4s-production/geonetwork/main.tf | 26 +-- openstack-tf/d4s-production/geoserver/main.tf | 168 ++++++++++++++++++ .../d4s-production/geoserver/provider.tf | 3 + 4 files changed, 198 insertions(+), 136 deletions(-) create mode 100644 openstack-tf/d4s-production/geoserver/main.tf create mode 100644 openstack-tf/d4s-production/geoserver/provider.tf diff --git a/openstack-tf/d4s-dev/geoserver/main.tf b/openstack-tf/d4s-dev/geoserver/main.tf index 569c553..f6ea9f7 100644 --- a/openstack-tf/d4s-dev/geoserver/main.tf +++ b/openstack-tf/d4s-dev/geoserver/main.tf @@ -17,7 +17,6 @@ data "terraform_remote_state" "privnet_dns_router" { } } - # # Uses common_variables as module # @@ -25,139 +24,31 @@ module "common_variables" { source = "../../modules/common_variables" } +# +# Creates the server group "geoserver" +# +resource "openstack_compute_servergroup_v2" "geoserver_server_group" { + name = "geoserver" + policies = [module.common_variables.policy_list.soft_anti_affinity] +} module "instance_with_data_volume" { source = "../../modules/instance_with_data_volume" - instances_with_data_volume_map = { - geona = { - name = "geoserver-geona", - description = "Geoserver geona instance", + instances_with_data_volume_map = { + geoserver_2 = { + name = "geoserver-2", + description = "Geoserver instance", flavor = module.common_variables.flavor_list.m1_large, networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], image_ref = module.common_variables.ubuntu_1804, volume = { - name = "geoserver-geona_data_volume", + name = "geoserver_2_data_volume", size = "50", device = "/dev/vdb" } - }, - esquiline = { - name = "geoserver-esquiline", - description = "Geoserver esquiline instance", - flavor = module.common_variables.flavor_list.m2_small, - networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], - security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], - image_ref = module.common_variables.ubuntu_1804, - volume = { - name = "geoserver-esquiline_data_volume", - size = "20", - device = "/dev/vdb", - } - }, - ariadne = { - name = "geoserver-ariadne", - description = "Geoserver ariadne instance", - flavor = module.common_variables.flavor_list.m2_small, - networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], - security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], - image_ref = module.common_variables.ubuntu_1804, - volume = { - name = "geoserver-ariadne_data_volume", - size = "20", - device = "/dev/vdb", - } - }, - grsf = { - name = "geoserver-grsf", - description = "Geoserver grsf instance", - flavor = module.common_variables.flavor_list.m1_large, - networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], - security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], - image_ref = module.common_variables.ubuntu_1804 - volume = { - name = "geoserver-grsf_data_volume" - size = "40", - device = "/dev/vdb", - } - }, - protectedareaimpactmaps = { - name = "geoserver-protectedareaimpactmaps", - description = "Geoserver protectedareaimpactmaps instance", - flavor = module.common_variables.flavor_list.c1_large, - networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], - security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], - image_ref = module.common_variables.ubuntu_1804, - volume = { - name = "geoserver-protectedareaimpactmaps_data_volume" - size = "70", - device = "/dev/vdb", - } } - sdi-lab = { - name = "geoserver-sdi-lab", - description = "Geoserver sdi-lab instance", - flavor = module.common_variables.flavor_list.m1_large, - networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], - security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], - image_ref = module.common_variables.ubuntu_1804, - volume = { - name = "geoserver-sdi-lab_data_volume", - size = "100", - device = "/dev/vdb", - } - } - tunaatlas = { - name = "geoserver-tunaatlas", - description = "Geoserver tunaatlas instance", - flavor = module.common_variables.flavor_list.m1_large, - networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], - security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], - image_ref = module.common_variables.ubuntu_1804, - volume = { - name = "geoserver-tunaatlas_data_volume", - size = "60", - device = "/dev/vdb", - } - } - wecafc-firms = { - name = "geoserver-wecafc-firms", - description = "Geoserver wecafc-firms instance", - flavor = module.common_variables.flavor_list.m1_large, - networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], - security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], - image_ref = module.common_variables.ubuntu_1804, - volume = { - name = "geoserver-wecafc-firms_data_volume", - size = "40", - device = "/dev/vdb", - } - } - aquacultureatlas = { - name = "geoserver-aquacultureatlas", - description = "Geoserver aquacultureatlas instance", - flavor = module.common_variables.flavor_list.m1_large, - networks = ["d4s-dev-cloud-main", module.common_variables.networks_list.shared_postgresql], - security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [], - image_ref = module.common_variables.ubuntu_1804, - volume = { - name = "geoserver-aquacultureatlas_data_volume", - size = "50", - device = "/dev/vdb", - } - } - - } - - + } } \ No newline at end of file diff --git a/openstack-tf/d4s-production/geonetwork/main.tf b/openstack-tf/d4s-production/geonetwork/main.tf index 118dfbc..ad817a8 100644 --- a/openstack-tf/d4s-production/geonetwork/main.tf +++ b/openstack-tf/d4s-production/geonetwork/main.tf @@ -26,10 +26,10 @@ module "common_variables" { # -# Creates the server group "sdi-geo" +# Creates the server group "geonetwork" # -resource "openstack_compute_servergroup_v2" "sdi_geo_server_group" { - name = "sdi-geo" +resource "openstack_compute_servergroup_v2" "geonetwork_server_group" { + name = "geonetwork" policies = [module.common_variables.policy_list.soft_anti_affinity] } @@ -44,7 +44,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_ariadne_data_volume", @@ -58,7 +58,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_fisherieatlas_data_volume", @@ -72,7 +72,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_grsf_data_volume", @@ -87,7 +87,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_iotcss3_data_volume", @@ -101,7 +101,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_sdilab_data_volume", @@ -115,7 +115,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_spatialdata_data_volume", @@ -129,7 +129,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_wecafcfirms_data_volume", @@ -143,7 +143,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_bluecloud_data_volume", @@ -157,7 +157,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m2_small, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_tunaatlas_data_volume", @@ -171,7 +171,7 @@ module "instance_with_data_volume" { flavor = module.common_variables.flavor_list.m1_large, networks = ["d4s-production-cloud-main",module.common_variables.networks_list.shared_postgresql], security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], - server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id], + server_groups_ids = [openstack_compute_servergroup_v2.geonetwork_server_group.id], image_ref = module.common_variables.ubuntu_1804 volume = { name = "geonetwork_prod_data_volume", diff --git a/openstack-tf/d4s-production/geoserver/main.tf b/openstack-tf/d4s-production/geoserver/main.tf new file mode 100644 index 0000000..91a266a --- /dev/null +++ b/openstack-tf/d4s-production/geoserver/main.tf @@ -0,0 +1,168 @@ +# Define required providers +terraform { + required_version = ">= 0.14.0" + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "~> 1.53.0" + } + } +} + +data "terraform_remote_state" "privnet_dns_router" { + backend = "local" + + config = { + path = "../project-setup/terraform.tfstate" + } +} + +# +# Uses common_variables as module +# +module "common_variables" { + source = "../../modules/common_variables" +} + + +# +# Creates the server group "geoserver" +# +resource "openstack_compute_servergroup_v2" "geoserver_server_group" { + name = "geoserver" + policies = [module.common_variables.policy_list.soft_anti_affinity] +} + + +module "instance_with_data_volume" { + source = "../../modules/instance_with_data_volume" + + instances_with_data_volume_map = { + geoserver_geona = { + name = "geoserver-geona", + description = "Geoserver geona instance", + flavor = module.common_variables.flavor_list.m1_large, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804, + volume = { + name = "geoserver_geona_data_volume", + size = "50", + device = "/dev/vdb" + } + }, + geoserver_esquiline = { + name = "geoserver-esquiline", + description = "Geoserver esquiline instance", + flavor = module.common_variables.flavor_list.m2_small, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804, + volume = { + name = "geoserver_esquiline_data_volume", + size = "20", + device = "/dev/vdb", + } + }, + geoserver_ariadne = { + name = "geoserver-ariadne", + description = "Geoserver ariadne instance", + flavor = module.common_variables.flavor_list.m2_small, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804, + volume = { + name = "geoserver_ariadne_data_volume", + size = "20", + device = "/dev/vdb", + } + }, + geoserver_grsf = { + name = "geoserver-grsf", + description = "Geoserver grsf instance", + flavor = module.common_variables.flavor_list.m1_large, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804 + volume = { + name = "geoserver_grsf_data_volume" + size = "40", + device = "/dev/vdb", + } + }, + geoserver_protectedareaimpactmaps = { + name = "geoserver-protectedareaimpactmaps", + description = "Geoserver protectedareaimpactmaps instance", + flavor = module.common_variables.flavor_list.c1_large, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804, + volume = { + name = "geoserver_protectedareaimpactmaps_data_volume" + size = "70", + device = "/dev/vdb", + } + } + geoserver_sdilab = { + name = "geoserver-sdilab", + description = "Geoserver sdilab instance", + flavor = module.common_variables.flavor_list.m1_large, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804, + volume = { + name = "geoserver_sdilab_data_volume", + size = "100", + device = "/dev/vdb", + } + } + geoserver_tunaatlas = { + name = "geoserver-tunaatlas", + description = "Geoserver tunaatlas instance", + flavor = module.common_variables.flavor_list.m1_large, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804, + volume = { + name = "geoserver_tunaatlas_data_volume", + size = "60", + device = "/dev/vdb", + } + } + geoserver_wecafcfirms = { + name = "geoserver-wecafcfirms", + description = "Geoserver wecafcfirms instance", + flavor = module.common_variables.flavor_list.m1_large, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804, + volume = { + name = "geoserver_wecafcfirms_data_volume", + size = "40", + device = "/dev/vdb", + } + } + geoserver_aquacultureatlas = { + name = "geoserver-aquacultureatlas", + description = "Geoserver aquacultureatlas instance", + flavor = module.common_variables.flavor_list.m1_large, + networks = ["d4s-prod-cloud-main", module.common_variables.networks_list.shared_postgresql], + security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers], + server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id], + image_ref = module.common_variables.ubuntu_1804, + volume = { + name = "geoserver_aquacultureatlas_data_volume", + size = "50", + device = "/dev/vdb", + } + } + } +} diff --git a/openstack-tf/d4s-production/geoserver/provider.tf b/openstack-tf/d4s-production/geoserver/provider.tf new file mode 100644 index 0000000..ca8de74 --- /dev/null +++ b/openstack-tf/d4s-production/geoserver/provider.tf @@ -0,0 +1,3 @@ +provider "openstack" { + cloud = "d4s-production" +} -- 2.17.1