From 117b0e7907cfc901469c740ed26cba7290095d82 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 21 Dec 2023 13:30:17 +0100 Subject: [PATCH] preprod liferay: recordset and s3 container. --- openstack-tf/d4s-preprod/liferay/main.tf | 64 +- .../d4s-preprod/liferay/terraform.tfstate | 771 +++++++++++++++++- .../modules/liferay/liferay-outputs.tf | 11 + .../modules/liferay/liferay-variables.tf | 13 + openstack-tf/modules/liferay/liferay.tf | 34 +- openstack-tf/modules/liferay/outputs.tf | 126 --- .../modules/liferay/terraform-provider.tf | 18 + openstack-tf/modules/liferay/variables.tf | 276 ------- 8 files changed, 822 insertions(+), 491 deletions(-) create mode 100644 openstack-tf/modules/liferay/liferay-outputs.tf delete mode 100644 openstack-tf/modules/liferay/outputs.tf delete mode 100644 openstack-tf/modules/liferay/variables.tf diff --git a/openstack-tf/d4s-preprod/liferay/main.tf b/openstack-tf/d4s-preprod/liferay/main.tf index 683012d..a1e8f0f 100644 --- a/openstack-tf/d4s-preprod/liferay/main.tf +++ b/openstack-tf/d4s-preprod/liferay/main.tf @@ -19,62 +19,6 @@ data "terraform_remote_state" "privnet_dns_router" { module "liferay" { source = "../../modules/liferay" - default_security_group_name = "default_for_all" - - # Provided in the output of the project setup - main_private_network_id = "23fd8a99-d551-4ada-8d3a-9859542ebb8c" - main_private_subnet_id = "cd77a2fd-4a36-4254-b1d0-70b3874c6d04" - dns_zone_id = "c1a4b4bc-f167-4387-855d-38f0f99ca05c" - - os_project_data = { - id = "6fdc02e2827b405dad99f34698659742" - } - - dns_zone = { - zone_name = "cloud-pre.d4science.org." - email = "postmaster@isti.cnr.it" - description = "DNS primary zone for the d4s-pre-cloud project" - ttl = 8600 - id = "c1a4b4bc-f167-4387-855d-38f0f99ca05c" - } - - main_private_network = { - name = "d4s-pre-cloud-main" - description = "D4Science Preprod private network (use this as the main network)" - } - - main_private_subnet = { - name = "d4s-pre-cloud-main-subnet" - description = "D4Science Preprod main private subnet" - cidr = "10.1.32.0/22" - gateway_ip = "10.1.32.1" - allocation_start = "10.1.32.100" - allocation_end = "10.1.35.254" - } - - external_router = { - name = "d4s-pre-cloud-external-router" - description = "D4Science Preprod main router" - id = "cc26064a-bb08-4c0b-929f-d0cb39f934a3" - } - - basic_services_ip = { - ca = "10.1.32.4" - ca_cidr = "10.1.32.4/32" - ssh_jump = "10.1.32.5" - ssh_jump_cidr = "10.1.32.5/32" - prometheus = "10.1.32.10" - prometheus_cidr = "10.1.32.10/32" - haproxy_l7_1 = "10.1.32.11" - haproxy_l7_1_cidr = "10.1.32.11/32" - haproxy_l7_2 = "10.1.32.12" - haproxy_l7_2_cidr = "10.1.32.12/32" - octavia_main = "10.1.32.20" - octavia_main_cidr = "10.1.32.20/32" - } - - main_haproxy_l7_ip = ["10.1.32.11", "10.1.32.12"] - liferay_data = { affinity_policy = "soft-anti-affinity" srv_name = "lr62" @@ -84,5 +28,11 @@ module "liferay" { } liferay_ip_addrs = ["10.1.32.24", "10.1.32.25"] -} + liferay_recordsets = { + liferay_main_record = { + name = join(".", ["next", data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name]), + description = "Liferay Pre (next)" + } + } +} diff --git a/openstack-tf/d4s-preprod/liferay/terraform.tfstate b/openstack-tf/d4s-preprod/liferay/terraform.tfstate index 2991533..c375217 100644 --- a/openstack-tf/d4s-preprod/liferay/terraform.tfstate +++ b/openstack-tf/d4s-preprod/liferay/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, - "terraform_version": "1.6.4", - "serial": 16, + "terraform_version": "1.6.6", + "serial": 19, "lineage": "2cef4407-f7f5-0a46-74de-03956dd178ed", "outputs": {}, "resources": [ @@ -29,31 +29,196 @@ "defaults": null, "outputs": { "value": { - "almalinux9_img": { + "almalinux_9": { "name": "AlmaLinux-9.0-20220718", "uuid": "541650fc-dd19-4f38-bb1d-7333ed9dd688" }, "availability_zone_no_gpu_name": "cnr-isti-nova-a", "availability_zone_with_gpu_name": "cnr-isti-nova-gpu-a", - "centos7_img": { + "availability_zones_names": { + "availability_zone_no_gpu": "cnr-isti-nova-a", + "availability_zone_with_gpu": "cnr-isti-nova-gpu-a" + }, + "basic_services_ip": { + "ca": "10.1.32.4", + "ca_cidr": "10.1.32.4/32", + "haproxy_l7_1": "10.1.32.11", + "haproxy_l7_1_cidr": "10.1.32.11/32", + "haproxy_l7_2": "10.1.32.12", + "haproxy_l7_2_cidr": "10.1.32.12/32", + "octavia_main": "10.1.32.20", + "octavia_main_cidr": "10.1.32.20/32", + "prometheus": "10.1.32.10", + "prometheus_cidr": "10.1.32.10/32", + "ssh_jump": "10.1.32.5", + "ssh_jump_cidr": "10.1.32.5/32" + }, + "centos_7": { "name": "CentOS-7", "uuid": "f0187a99-64f6-462a-ab5f-ef52fe62f2ca" }, + "default_security_group_name": "default_for_all", + "dns_zone": { + "description": "DNS primary zone for the d4s-pre-cloud project", + "email": "postmaster@isti.cnr.it", + "id": "c1a4b4bc-f167-4387-855d-38f0f99ca05c", + "ttl": "8600", + "zone_name": "cloud-pre.d4science.org." + }, "dns_zone_id": "c1a4b4bc-f167-4387-855d-38f0f99ca05c", - "el7_datafile": "../../openstack_vm_data_scripts/el7.sh", - "external_gateway_ip": "146.48.30.241", + "el7_data_file": "../../openstack_vm_data_scripts/el7.sh", + "external_gateway_ip": [ + { + "ip_address": "146.48.30.241", + "subnet_id": "57f87509-4016-46fb-b8c3-25fca7f72ccb" + } + ], + "external_network": { + "id": "1d2ff137-6ff7-4017-be2b-0d6c4af2353b", + "name": "external-network" + }, "external_network_id": "1d2ff137-6ff7-4017-be2b-0d6c4af2353b", - "external_network_name": "external-network", + "external_router": { + "description": "D4Science Preprod main router", + "id": "cc26064a-bb08-4c0b-929f-d0cb39f934a3", + "name": "d4s-pre-cloud-external-router" + }, + "flavor_list": { + "c1_large": "c1.large", + "c1_medium": "c1.medium", + "c1_small": "c1.small", + "c2_large": "c2.large", + "m1_large": "m1.large", + "m1_medium": "m1.medium", + "m1_xlarge": "m1.xlarge", + "m1_xxl": "m1.xxl", + "m2_large": "m2.large", + "m2_medium": "m2.medium", + "m2_small": "m2.small", + "m3_large": "m3.large" + }, + "floating_ip_pools": { + "main_public_ip_pool": "external-network" + }, + "haproxy_l7_data": { + "flavor": "m1.medium", + "haproxy_1": "haproxy-l7-1", + "haproxy_2": "haproxy-l7-2", + "name": "main-haproxy-l7", + "vm_count": "2" + }, + "internal_ca_data": { + "flavor": "m1.small", + "name": "ca" + }, + "main_haproxy_l7_ip": [ + "10.1.32.11", + "10.1.32.12" + ], + "main_private_network": { + "description": "D4Science Preprod private network (use this as the main network)", + "name": "d4s-pre-cloud-main" + }, "main_private_network_id": "23fd8a99-d551-4ada-8d3a-9859542ebb8c", - "main_region_name": "isti_area_pi_1", + "main_private_subnet": { + "allocation_end": "10.1.35.254", + "allocation_start": "10.1.32.100", + "cidr": "10.1.32.0/22", + "description": "D4Science Preprod main private subnet", + "gateway_ip": "10.1.32.1", + "name": "d4s-pre-cloud-main-subnet" + }, + "main_region": "isti_area_pi_1", "main_subnet_network_id": "cd77a2fd-4a36-4254-b1d0-70b3874c6d04", - "mtu_size_value": 8942, + "mtu_size": 8942, + "networks_list": { + "orientdb": "orientdb-net", + "orientdb_se": "orientdb-se-net", + "shared_postgresql": "postgresql-srv-net", + "swarm": "swarm-nfs-net", + "timescaledb": "timescaledb-net" + }, + "networks_with_d4s_services": { + "garr_ct1_net": "90.147.166.0/23", + "garr_na_net": "90.147.152.0/24", + "garr_pa1_net": "90.147.188.0/23", + "infrascience_net": "146.48.122.0/23", + "isti_net": "146.48.80.0/21", + "s2i2s_net": "146.48.28.0/22" + }, + "octavia_information": { + "main_lb_description": "Main L4 load balancer for the D4Science PRE production", + "main_lb_hostname": "main-lb", + "main_lb_name": "d4s-pre-cloud-l4-load-balancer", + "octavia_flavor": "octavia_amphora-mvcpu-ha", + "octavia_flavor_id": "394988b5-6603-4a1e-a939-8e177c6681c7", + "octavia_vrrp_ip_1": "10.1.33.159/32", + "octavia_vrrp_ip_2": "10.1.32.199/32", + "swarm_lb_name": "d4s-pre-cloud-l4-swarm-load-balancer" + }, + "os_project_data": { + "id": "6fdc02e2827b405dad99f34698659742" + }, + "policy_list": { + "affinity": "affinity", + "anti_affinity": "anti-affinity", + "soft_affinity": "soft-affinity", + "soft_anti_affinity": "soft-anti-affinity" + }, + "prometheus_server_data": { + "flavor": "m1.medium", + "name": "prometheus", + "public_grafana_server_cidr": "146.48.122.132/32", + "vol_data_device": "/dev/vdb", + "vol_data_name": "prometheus-data", + "vol_data_size": "100" + }, "resolvers_ip": [ "146.48.29.97", "146.48.29.98", "146.48.29.99" ], - "ssh_sources_list": { + "resource_registry_addresses": {}, + "security_group_list": { + "acaland": "acaland's dev machine", + "access_to_orientdb": "access_to_orientdb", + "access_to_orientdb_se": "access_to_orientdb_se", + "access_to_the_timescaledb_service": "access_to_the_timescaledb_service", + "cassandra": "Cassandra", + "dataminer-publish": "dataminer-publish", + "debugging_from_jump_node": "debugging_from_jump_node", + "default": "default", + "docker_swarm": "Docker Swarm", + "docker_swarm_NFS": "Docker Swarm NFS", + "haproxy": "traffic_from_main_lb_to_haproxy_l7", + "http_and_https_from_the_load_balancers": "traffic_from_the_main_load_balancers", + "limited_HTTPS_access": "restricted_web_service", + "limited_SSH_access": "Limited SSH access", + "mongo": "mongo", + "orientdb_internal_docker_traffic": "orientdb_internal_docker_traffic", + "postgreSQL": "PostgreSQL service", + "public_HTTPS": "Public HTTPS" + }, + "shared_postgresql_server_data": { + "allocation_pool_end": "192.168.3.254", + "allocation_pool_start": "192.168.0.100", + "flavor": "m1.medium", + "name": "shared-postgresql-server", + "network_cidr": "192.168.0.0/22", + "network_description": "Network used to communicate with the shared postgresql service", + "network_name": "postgresql-srv-net", + "server_cidr": "192.168.0.5/22", + "server_ip": "192.168.0.5", + "vol_data_device": "/dev/vdb", + "vol_data_name": "shared-postgresql-data", + "vol_data_size": "100" + }, + "smartexecutor_addresses": {}, + "ssh_jump_proxy": { + "flavor": "m2.small", + "name": "ssh-jump-proxy" + }, + "ssh_sources": { "d4s_vpn_1_cidr": "146.48.122.27/32", "d4s_vpn_2_cidr": "146.48.122.49/32", "infrascience_net_cidr": "146.48.122.0/23", @@ -61,54 +226,542 @@ "s2i2s_vpn_2_cidr": "146.48.28.11/32", "shell_d4s_cidr": "146.48.122.95/32" }, - "ubuntu1804_datafile": "../../openstack_vm_data_scripts/ubuntu1804.sh", - "ubuntu1804_img": { + "ubuntu1804_data_file": "../../openstack_vm_data_scripts/ubuntu1804.sh", + "ubuntu2204_data_file": "../../openstack_vm_data_scripts/ubuntu2204.sh", + "ubuntu_1804": { "name": "Ubuntu-Bionic-18.04", + "user_data_file": "../../openstack_vm_data_scripts/ubuntu1804.sh", "uuid": "7ed6a2cd-2b07-482e-8ce4-f018dff16c89" }, - "ubuntu2204_datafile": "../../openstack_vm_data_scripts/ubuntu2204.sh", - "ubuntu2204_img": { + "ubuntu_2204": { "name": "Ubuntu-Jammy-22.04", + "user_data_file": "../../openstack_vm_data_scripts/ubuntu2204.sh", "uuid": "54768889-8556-4be4-a2eb-82a4d9b34627" } }, "type": [ "object", { - "almalinux9_img": [ + "almalinux_9": [ "map", "string" ], "availability_zone_no_gpu_name": "string", "availability_zone_with_gpu_name": "string", - "centos7_img": [ + "availability_zones_names": [ + "map", + "string" + ], + "basic_services_ip": [ + "map", + "string" + ], + "centos_7": [ + "map", + "string" + ], + "default_security_group_name": "string", + "dns_zone": [ "map", "string" ], "dns_zone_id": "string", - "el7_datafile": "string", - "external_gateway_ip": "string", + "el7_data_file": "string", + "external_gateway_ip": [ + "list", + [ + "object", + { + "ip_address": "string", + "subnet_id": "string" + } + ] + ], + "external_network": [ + "map", + "string" + ], "external_network_id": "string", - "external_network_name": "string", + "external_router": [ + "map", + "string" + ], + "flavor_list": [ + "map", + "string" + ], + "floating_ip_pools": [ + "map", + "string" + ], + "haproxy_l7_data": [ + "map", + "string" + ], + "internal_ca_data": [ + "map", + "string" + ], + "main_haproxy_l7_ip": [ + "list", + "string" + ], + "main_private_network": [ + "map", + "string" + ], "main_private_network_id": "string", - "main_region_name": "string", + "main_private_subnet": [ + "map", + "string" + ], + "main_region": "string", "main_subnet_network_id": "string", - "mtu_size_value": "number", + "mtu_size": "number", + "networks_list": [ + "map", + "string" + ], + "networks_with_d4s_services": [ + "map", + "string" + ], + "octavia_information": [ + "map", + "string" + ], + "os_project_data": [ + "map", + "string" + ], + "policy_list": [ + "map", + "string" + ], + "prometheus_server_data": [ + "map", + "string" + ], "resolvers_ip": [ "list", "string" ], - "ssh_sources_list": [ + "resource_registry_addresses": [ "map", "string" ], - "ubuntu1804_datafile": "string", - "ubuntu1804_img": [ + "security_group_list": [ "map", "string" ], - "ubuntu2204_datafile": "string", - "ubuntu2204_img": [ + "shared_postgresql_server_data": [ + "map", + "string" + ], + "smartexecutor_addresses": [ + "map", + "string" + ], + "ssh_jump_proxy": [ + "map", + "string" + ], + "ssh_sources": [ + "map", + "string" + ], + "ubuntu1804_data_file": "string", + "ubuntu2204_data_file": "string", + "ubuntu_1804": [ + "map", + "string" + ], + "ubuntu_2204": [ + "map", + "string" + ] + } + ] + }, + "workspace": null + }, + "sensitive_attributes": [] + } + ] + }, + { + "module": "module.liferay", + "mode": "data", + "type": "terraform_remote_state", + "name": "privnet_dns_router", + "provider": "provider[\"terraform.io/builtin/terraform\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "backend": "local", + "config": { + "value": { + "path": "../project-setup/terraform.tfstate" + }, + "type": [ + "object", + { + "path": "string" + } + ] + }, + "defaults": null, + "outputs": { + "value": { + "almalinux_9": { + "name": "AlmaLinux-9.0-20220718", + "uuid": "541650fc-dd19-4f38-bb1d-7333ed9dd688" + }, + "availability_zone_no_gpu_name": "cnr-isti-nova-a", + "availability_zone_with_gpu_name": "cnr-isti-nova-gpu-a", + "availability_zones_names": { + "availability_zone_no_gpu": "cnr-isti-nova-a", + "availability_zone_with_gpu": "cnr-isti-nova-gpu-a" + }, + "basic_services_ip": { + "ca": "10.1.32.4", + "ca_cidr": "10.1.32.4/32", + "haproxy_l7_1": "10.1.32.11", + "haproxy_l7_1_cidr": "10.1.32.11/32", + "haproxy_l7_2": "10.1.32.12", + "haproxy_l7_2_cidr": "10.1.32.12/32", + "octavia_main": "10.1.32.20", + "octavia_main_cidr": "10.1.32.20/32", + "prometheus": "10.1.32.10", + "prometheus_cidr": "10.1.32.10/32", + "ssh_jump": "10.1.32.5", + "ssh_jump_cidr": "10.1.32.5/32" + }, + "centos_7": { + "name": "CentOS-7", + "uuid": "f0187a99-64f6-462a-ab5f-ef52fe62f2ca" + }, + "default_security_group_name": "default_for_all", + "dns_zone": { + "description": "DNS primary zone for the d4s-pre-cloud project", + "email": "postmaster@isti.cnr.it", + "id": "c1a4b4bc-f167-4387-855d-38f0f99ca05c", + "ttl": "8600", + "zone_name": "cloud-pre.d4science.org." + }, + "dns_zone_id": "c1a4b4bc-f167-4387-855d-38f0f99ca05c", + "el7_data_file": "../../openstack_vm_data_scripts/el7.sh", + "external_gateway_ip": [ + { + "ip_address": "146.48.30.241", + "subnet_id": "57f87509-4016-46fb-b8c3-25fca7f72ccb" + } + ], + "external_network": { + "id": "1d2ff137-6ff7-4017-be2b-0d6c4af2353b", + "name": "external-network" + }, + "external_network_id": "1d2ff137-6ff7-4017-be2b-0d6c4af2353b", + "external_router": { + "description": "D4Science Preprod main router", + "id": "cc26064a-bb08-4c0b-929f-d0cb39f934a3", + "name": "d4s-pre-cloud-external-router" + }, + "flavor_list": { + "c1_large": "c1.large", + "c1_medium": "c1.medium", + "c1_small": "c1.small", + "c2_large": "c2.large", + "m1_large": "m1.large", + "m1_medium": "m1.medium", + "m1_xlarge": "m1.xlarge", + "m1_xxl": "m1.xxl", + "m2_large": "m2.large", + "m2_medium": "m2.medium", + "m2_small": "m2.small", + "m3_large": "m3.large" + }, + "floating_ip_pools": { + "main_public_ip_pool": "external-network" + }, + "haproxy_l7_data": { + "flavor": "m1.medium", + "haproxy_1": "haproxy-l7-1", + "haproxy_2": "haproxy-l7-2", + "name": "main-haproxy-l7", + "vm_count": "2" + }, + "internal_ca_data": { + "flavor": "m1.small", + "name": "ca" + }, + "main_haproxy_l7_ip": [ + "10.1.32.11", + "10.1.32.12" + ], + "main_private_network": { + "description": "D4Science Preprod private network (use this as the main network)", + "name": "d4s-pre-cloud-main" + }, + "main_private_network_id": "23fd8a99-d551-4ada-8d3a-9859542ebb8c", + "main_private_subnet": { + "allocation_end": "10.1.35.254", + "allocation_start": "10.1.32.100", + "cidr": "10.1.32.0/22", + "description": "D4Science Preprod main private subnet", + "gateway_ip": "10.1.32.1", + "name": "d4s-pre-cloud-main-subnet" + }, + "main_region": "isti_area_pi_1", + "main_subnet_network_id": "cd77a2fd-4a36-4254-b1d0-70b3874c6d04", + "mtu_size": 8942, + "networks_list": { + "orientdb": "orientdb-net", + "orientdb_se": "orientdb-se-net", + "shared_postgresql": "postgresql-srv-net", + "swarm": "swarm-nfs-net", + "timescaledb": "timescaledb-net" + }, + "networks_with_d4s_services": { + "garr_ct1_net": "90.147.166.0/23", + "garr_na_net": "90.147.152.0/24", + "garr_pa1_net": "90.147.188.0/23", + "infrascience_net": "146.48.122.0/23", + "isti_net": "146.48.80.0/21", + "s2i2s_net": "146.48.28.0/22" + }, + "octavia_information": { + "main_lb_description": "Main L4 load balancer for the D4Science PRE production", + "main_lb_hostname": "main-lb", + "main_lb_name": "d4s-pre-cloud-l4-load-balancer", + "octavia_flavor": "octavia_amphora-mvcpu-ha", + "octavia_flavor_id": "394988b5-6603-4a1e-a939-8e177c6681c7", + "octavia_vrrp_ip_1": "10.1.33.159/32", + "octavia_vrrp_ip_2": "10.1.32.199/32", + "swarm_lb_name": "d4s-pre-cloud-l4-swarm-load-balancer" + }, + "os_project_data": { + "id": "6fdc02e2827b405dad99f34698659742" + }, + "policy_list": { + "affinity": "affinity", + "anti_affinity": "anti-affinity", + "soft_affinity": "soft-affinity", + "soft_anti_affinity": "soft-anti-affinity" + }, + "prometheus_server_data": { + "flavor": "m1.medium", + "name": "prometheus", + "public_grafana_server_cidr": "146.48.122.132/32", + "vol_data_device": "/dev/vdb", + "vol_data_name": "prometheus-data", + "vol_data_size": "100" + }, + "resolvers_ip": [ + "146.48.29.97", + "146.48.29.98", + "146.48.29.99" + ], + "resource_registry_addresses": {}, + "security_group_list": { + "acaland": "acaland's dev machine", + "access_to_orientdb": "access_to_orientdb", + "access_to_orientdb_se": "access_to_orientdb_se", + "access_to_the_timescaledb_service": "access_to_the_timescaledb_service", + "cassandra": "Cassandra", + "dataminer-publish": "dataminer-publish", + "debugging_from_jump_node": "debugging_from_jump_node", + "default": "default", + "docker_swarm": "Docker Swarm", + "docker_swarm_NFS": "Docker Swarm NFS", + "haproxy": "traffic_from_main_lb_to_haproxy_l7", + "http_and_https_from_the_load_balancers": "traffic_from_the_main_load_balancers", + "limited_HTTPS_access": "restricted_web_service", + "limited_SSH_access": "Limited SSH access", + "mongo": "mongo", + "orientdb_internal_docker_traffic": "orientdb_internal_docker_traffic", + "postgreSQL": "PostgreSQL service", + "public_HTTPS": "Public HTTPS" + }, + "shared_postgresql_server_data": { + "allocation_pool_end": "192.168.3.254", + "allocation_pool_start": "192.168.0.100", + "flavor": "m1.medium", + "name": "shared-postgresql-server", + "network_cidr": "192.168.0.0/22", + "network_description": "Network used to communicate with the shared postgresql service", + "network_name": "postgresql-srv-net", + "server_cidr": "192.168.0.5/22", + "server_ip": "192.168.0.5", + "vol_data_device": "/dev/vdb", + "vol_data_name": "shared-postgresql-data", + "vol_data_size": "100" + }, + "smartexecutor_addresses": {}, + "ssh_jump_proxy": { + "flavor": "m2.small", + "name": "ssh-jump-proxy" + }, + "ssh_sources": { + "d4s_vpn_1_cidr": "146.48.122.27/32", + "d4s_vpn_2_cidr": "146.48.122.49/32", + "infrascience_net_cidr": "146.48.122.0/23", + "s2i2s_vpn_1_cidr": "146.48.28.10/32", + "s2i2s_vpn_2_cidr": "146.48.28.11/32", + "shell_d4s_cidr": "146.48.122.95/32" + }, + "ubuntu1804_data_file": "../../openstack_vm_data_scripts/ubuntu1804.sh", + "ubuntu2204_data_file": "../../openstack_vm_data_scripts/ubuntu2204.sh", + "ubuntu_1804": { + "name": "Ubuntu-Bionic-18.04", + "user_data_file": "../../openstack_vm_data_scripts/ubuntu1804.sh", + "uuid": "7ed6a2cd-2b07-482e-8ce4-f018dff16c89" + }, + "ubuntu_2204": { + "name": "Ubuntu-Jammy-22.04", + "user_data_file": "../../openstack_vm_data_scripts/ubuntu2204.sh", + "uuid": "54768889-8556-4be4-a2eb-82a4d9b34627" + } + }, + "type": [ + "object", + { + "almalinux_9": [ + "map", + "string" + ], + "availability_zone_no_gpu_name": "string", + "availability_zone_with_gpu_name": "string", + "availability_zones_names": [ + "map", + "string" + ], + "basic_services_ip": [ + "map", + "string" + ], + "centos_7": [ + "map", + "string" + ], + "default_security_group_name": "string", + "dns_zone": [ + "map", + "string" + ], + "dns_zone_id": "string", + "el7_data_file": "string", + "external_gateway_ip": [ + "list", + [ + "object", + { + "ip_address": "string", + "subnet_id": "string" + } + ] + ], + "external_network": [ + "map", + "string" + ], + "external_network_id": "string", + "external_router": [ + "map", + "string" + ], + "flavor_list": [ + "map", + "string" + ], + "floating_ip_pools": [ + "map", + "string" + ], + "haproxy_l7_data": [ + "map", + "string" + ], + "internal_ca_data": [ + "map", + "string" + ], + "main_haproxy_l7_ip": [ + "list", + "string" + ], + "main_private_network": [ + "map", + "string" + ], + "main_private_network_id": "string", + "main_private_subnet": [ + "map", + "string" + ], + "main_region": "string", + "main_subnet_network_id": "string", + "mtu_size": "number", + "networks_list": [ + "map", + "string" + ], + "networks_with_d4s_services": [ + "map", + "string" + ], + "octavia_information": [ + "map", + "string" + ], + "os_project_data": [ + "map", + "string" + ], + "policy_list": [ + "map", + "string" + ], + "prometheus_server_data": [ + "map", + "string" + ], + "resolvers_ip": [ + "list", + "string" + ], + "resource_registry_addresses": [ + "map", + "string" + ], + "security_group_list": [ + "map", + "string" + ], + "shared_postgresql_server_data": [ + "map", + "string" + ], + "smartexecutor_addresses": [ + "map", + "string" + ], + "ssh_jump_proxy": [ + "map", + "string" + ], + "ssh_sources": [ + "map", + "string" + ], + "ubuntu1804_data_file": "string", + "ubuntu2204_data_file": "string", + "ubuntu_1804": [ + "map", + "string" + ], + "ubuntu_2204": [ "map", "string" ] @@ -221,6 +874,7 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19", "dependencies": [ + "module.liferay.data.terraform_remote_state.privnet_dns_router", "module.liferay.openstack_compute_servergroup_v2.liferay", "module.liferay.openstack_networking_secgroup_v2.liferay_cluster_traffic" ] @@ -318,6 +972,7 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19", "dependencies": [ + "module.liferay.data.terraform_remote_state.privnet_dns_router", "module.liferay.openstack_compute_servergroup_v2.liferay", "module.liferay.openstack_networking_secgroup_v2.liferay_cluster_traffic" ] @@ -356,6 +1011,41 @@ } ] }, + { + "module": "module.liferay", + "mode": "managed", + "type": "openstack_dns_recordset_v2", + "name": "cdn_dns_recordset", + "provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]", + "instances": [ + { + "index_key": "liferay_main_record", + "schema_version": 0, + "attributes": { + "description": "Liferay Pre (next)", + "disable_status_check": false, + "id": "c1a4b4bc-f167-4387-855d-38f0f99ca05c/c5d71a13-2582-4527-a261-1cfe0b81a7d7", + "name": "next.cloud-pre.d4science.org.", + "project_id": "6fdc02e2827b405dad99f34698659742", + "records": [ + "main-lb.cloud-pre.d4science.org." + ], + "region": "isti_area_pi_1", + "timeouts": null, + "ttl": 8600, + "type": "CNAME", + "value_specs": null, + "zone_id": "c1a4b4bc-f167-4387-855d-38f0f99ca05c" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH19", + "dependencies": [ + "data.terraform_remote_state.privnet_dns_router", + "module.liferay.data.terraform_remote_state.privnet_dns_router" + ] + } + ] + }, { "module": "module.liferay", "mode": "managed", @@ -437,6 +1127,35 @@ "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjo2MDAwMDAwMDAwMDB9fQ==" } ] + }, + { + "module": "module.liferay", + "mode": "managed", + "type": "openstack_objectstorage_container_v1", + "name": "liferay", + "provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "container_read": null, + "container_sync_key": null, + "container_sync_to": null, + "container_write": null, + "content_type": null, + "force_destroy": false, + "id": "liferay-data", + "metadata": null, + "name": "liferay-data", + "region": "isti_area_pi_1", + "storage_policy": "default-placement", + "versioning": false, + "versioning_legacy": [] + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" + } + ] } ], "check_results": null diff --git a/openstack-tf/modules/liferay/liferay-outputs.tf b/openstack-tf/modules/liferay/liferay-outputs.tf new file mode 100644 index 0000000..a1805ab --- /dev/null +++ b/openstack-tf/modules/liferay/liferay-outputs.tf @@ -0,0 +1,11 @@ +output "liferay_data" { + value = var.liferay_data +} + +output "liferay_ip_addrs" { + value = var.liferay_ip_addrs +} + +output "liferay_recordsets" { + value = var.liferay_recordsets +} \ No newline at end of file diff --git a/openstack-tf/modules/liferay/liferay-variables.tf b/openstack-tf/modules/liferay/liferay-variables.tf index 83a6d63..a7baa62 100644 --- a/openstack-tf/modules/liferay/liferay-variables.tf +++ b/openstack-tf/modules/liferay/liferay-variables.tf @@ -13,3 +13,16 @@ variable "liferay_ip_addrs" { type = list(string) default = [] } + +variable "liferay_recordsets" { + type = map(object({ + name = string + description = string + })) + default = { + liferay_dns_record = { + name = "", + description = "" + } + } +} diff --git a/openstack-tf/modules/liferay/liferay.tf b/openstack-tf/modules/liferay/liferay.tf index a885c68..b508a5a 100644 --- a/openstack-tf/modules/liferay/liferay.tf +++ b/openstack-tf/modules/liferay/liferay.tf @@ -20,6 +20,14 @@ resource "openstack_networking_secgroup_rule_v2" "traffic_between_liferay_nodes" remote_ip_prefix = join("/", [element(var.liferay_ip_addrs.*, count.index), "32"]) } +# +# Object storage container +# +# Creating object bucket to store avatars +resource "openstack_objectstorage_container_v1" "liferay" { + name = "liferay-data" + versioning = true +} # # Server group # @@ -32,15 +40,15 @@ resource "openstack_compute_servergroup_v2" "liferay" { resource "openstack_compute_instance_v2" "liferay" { count = var.liferay_data.vm_count name = format("%s-%02d", var.liferay_data.srv_name, count.index + 1) - availability_zone_hints = var.availability_zones_names.availability_zone_no_gpu + availability_zone_hints = module.common_variables.availability_zones_names.availability_zone_no_gpu flavor_name = var.liferay_data.vm_flavor key_pair = module.ssh_settings.ssh_key_name - security_groups = [var.default_security_group_name, openstack_networking_secgroup_v2.liferay_cluster_traffic.name, "traffic_from_the_main_load_balancers", "restricted_web_service"] + security_groups = [data.terraform_remote_state.privnet_dns_router.outputs.default_security_group_name, openstack_networking_secgroup_v2.liferay_cluster_traffic.name, data.terraform_remote_state.privnet_dns_router.outputs.security_group_list.http_and_https_from_the_load_balancers, "restricted_web_service"] scheduler_hints { group = openstack_compute_servergroup_v2.liferay.id } block_device { - uuid = var.ubuntu_1804.uuid + uuid = data.terraform_remote_state.privnet_dns_router.outputs.ubuntu_1804.uuid source_type = "image" volume_size = var.liferay_data.boot_vol_size boot_index = 0 @@ -49,13 +57,13 @@ resource "openstack_compute_instance_v2" "liferay" { } network { - name = var.main_private_network.name + name = data.terraform_remote_state.privnet_dns_router.outputs.main_private_network.name fixed_ip_v4 = var.liferay_ip_addrs.* [count.index] } network { - name = var.shared_postgresql_server_data.network_name + name = module.common_variables.shared_postgresql_server_data.network_name } - user_data = file("${var.ubuntu1804_data_file}") + user_data = file("${data.terraform_remote_state.privnet_dns_router.outputs.ubuntu1804_data_file}") # Do not replace the instance when the ssh key changes lifecycle { ignore_changes = [ @@ -65,3 +73,17 @@ resource "openstack_compute_instance_v2" "liferay" { ] } } + +resource "openstack_dns_recordset_v2" "cdn_dns_recordset" { + for_each = var.liferay_recordsets + zone_id = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone_id + name = each.value.name + description = each.value.description + ttl = 8600 + type = "CNAME" + records = [local.cname_target] +} + +locals { + cname_target = "main-lb.${data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name}" +} \ No newline at end of file diff --git a/openstack-tf/modules/liferay/outputs.tf b/openstack-tf/modules/liferay/outputs.tf deleted file mode 100644 index 285faca..0000000 --- a/openstack-tf/modules/liferay/outputs.tf +++ /dev/null @@ -1,126 +0,0 @@ - -output "main_region" { - value = var.main_region -} - -output "external_network" { - value = var.external_network -} - -output "external_network_id" { - value = var.external_network.id -} - -output "floating_ip_pools" { - value = var.floating_ip_pools - -} - -output "resolvers_ip" { - value = var.resolvers_ip -} - -output "mtu_size" { - value = var.mtu_size -} - -output "availability_zones_names" { - value = var.availability_zones_names -} - -output "availability_zone_no_gpu_name" { - value = var.availability_zones_names.availability_zone_no_gpu -} - -output "availability_zone_with_gpu_name" { - value = var.availability_zones_names.availability_zone_with_gpu -} - -output "ssh_sources" { - value = var.ssh_sources -} - -output "networks_with_d4s_services" { - value = var.networks_with_d4s_services -} - -output "ubuntu_1804" { - value = var.ubuntu_1804 -} - -output "ubuntu_2204" { - value = var.ubuntu_2204 -} - -output "centos_7" { - value = var.centos_7 -} - -output "almalinux_9" { - value = var.almalinux_9 -} - -output "ubuntu1804_data_file" { - value = var.ubuntu1804_data_file -} - -output "ubuntu2204_data_file" { - value = var.ubuntu2204_data_file -} - -output "el7_data_file" { - value = var.el7_data_file -} - -output "ssh_jump_proxy" { - value = var.ssh_jump_proxy -} - -output "internal_ca_data" { - value = var.internal_ca_data -} - -output "prometheus_server_data" { - value = var.prometheus_server_data -} - -output "shared_postgresql_server_data" { - value = var.shared_postgresql_server_data -} - -output "haproxy_l7_data" { - value = var.haproxy_l7_data -} - -output "resource_registry_addresses" { - value = var.resource_registry_addresses -} - -output "smartexecutor_addresses" { - value = var.smartexecutor_addresses -} - -#Added by Francesco -output "policy_list" { - value = var.policy_list -} - -#Added by Francesco -output "flavor_list" { - value = var.flavor_list -} - -#Added by Francesco -output "security_group_list" { - value = var.security_group_list -} - -#Added by Francesco -output "networks_list" { - value = var.networks_list -} - -# output "default_security_group_name" { -# value = var.default_security_group_name -# } - diff --git a/openstack-tf/modules/liferay/terraform-provider.tf b/openstack-tf/modules/liferay/terraform-provider.tf index a931880..f3678ce 100644 --- a/openstack-tf/modules/liferay/terraform-provider.tf +++ b/openstack-tf/modules/liferay/terraform-provider.tf @@ -9,3 +9,21 @@ terraform { } } +data "terraform_remote_state" "privnet_dns_router" { + backend = "local" + + config = { + path = "../project-setup/terraform.tfstate" + } +} + +# SSH settings +module "ssh_settings" { + source = "../../modules/ssh-key-ref" +} + +# Global variables (constants, really) +module "common_variables" { + source = "../../modules/common_variables" +} + diff --git a/openstack-tf/modules/liferay/variables.tf b/openstack-tf/modules/liferay/variables.tf deleted file mode 100644 index 2fb96ba..0000000 --- a/openstack-tf/modules/liferay/variables.tf +++ /dev/null @@ -1,276 +0,0 @@ -# Global definitions -variable "main_region" { - type = string - default = "isti_area_pi_1" -} - -variable "external_network" { - type = map(string) - default = { - name = "external-network" - id = "1d2ff137-6ff7-4017-be2b-0d6c4af2353b" - } -} - -variable "floating_ip_pools" { - type = map(string) - default = { - main_public_ip_pool = "external-network" - } -} - -variable "resolvers_ip" { - type = list(string) - default = ["146.48.29.97", "146.48.29.98", "146.48.29.99"] -} - -variable "mtu_size" { - type = number - default = 8942 -} - -variable "availability_zones_names" { - type = map(string) - default = { - availability_zone_no_gpu = "cnr-isti-nova-a" - availability_zone_with_gpu = "cnr-isti-nova-gpu-a" - } -} - -variable "ubuntu_1804" { - type = map(string) - - default = { - name = "Ubuntu-Bionic-18.04" - uuid = "7ed6a2cd-2b07-482e-8ce4-f018dff16c89" - user_data_file = "../../openstack_vm_data_scripts/ubuntu1804.sh" - } -} - -variable "ubuntu_2204" { - type = map(string) - default = { - name = "Ubuntu-Jammy-22.04" - uuid = "54768889-8556-4be4-a2eb-82a4d9b34627" - user_data_file = "../../openstack_vm_data_scripts/ubuntu2204.sh" - } -} - -variable "centos_7" { - type = map(string) - default = { - name = "CentOS-7" - uuid = "f0187a99-64f6-462a-ab5f-ef52fe62f2ca" - } -} - -variable "almalinux_9" { - type = map(string) - default = { - name = "AlmaLinux-9.0-20220718" - uuid = "541650fc-dd19-4f38-bb1d-7333ed9dd688" - } -} - -variable "ubuntu1804_data_file" { - default = "../../openstack_vm_data_scripts/ubuntu1804.sh" -} - -variable "ubuntu2204_data_file" { - default = "../../openstack_vm_data_scripts/ubuntu2204.sh" -} - -variable "el7_data_file" { - default = "../../openstack_vm_data_scripts/el7.sh" -} - -variable "ssh_jump_proxy" { - type = map(string) - default = { - name = "ssh-jump-proxy" - flavor = "m2.small" - } -} - -variable "internal_ca_data" { - type = map(string) - default = { - name = "ca" - flavor = "m1.small" - } -} - -variable "prometheus_server_data" { - type = map(string) - default = { - name = "prometheus" - flavor = "m1.medium" - vol_data_name = "prometheus-data" - vol_data_size = "100" - vol_data_device = "/dev/vdb" - public_grafana_server_cidr = "146.48.122.132/32" - } -} - -variable "shared_postgresql_server_data" { - type = map(string) - default = { - name = "shared-postgresql-server" - flavor = "m1.medium" - vol_data_name = "shared-postgresql-data" - vol_data_size = "100" - vol_data_device = "/dev/vdb" - # vol_backup_name = "" - # vol_backup_size = "" - # vol_backup_device = "" - network_name = "postgresql-srv-net" - network_description = "Network used to communicate with the shared postgresql service" - network_cidr = "192.168.0.0/22" - allocation_pool_start = "192.168.0.100" - allocation_pool_end = "192.168.3.254" - server_ip = "192.168.0.5" - server_cidr = "192.168.0.5/22" - } -} - -variable "haproxy_l7_data" { - type = map(string) - default = { - name = "main-haproxy-l7" - haproxy_1 = "haproxy-l7-1" - haproxy_2 = "haproxy-l7-2" - flavor = "m1.medium" - vm_count = "2" - } -} - -variable "resource_registry_addresses" { - type = map(string) - default = { - } -} - -variable "smartexecutor_addresses" { - type = map(string) - default = { - } -} - -# Added by Francesco -# Create in the path 'modules/ssh-key-ref' the file 'ssh-key-ref-outputs.tf' -# with the following outputs: - -# output "ssh_key_file" { -# value = "~/.ssh/{YOUR_PRIVATE_KEYNAME}" -# sensitive = true -# } - -# output "ssh_key_name" { -# value = "{YOUR_KEYNAME}" -# sensitive = false -# } - -# Then you can use above outputs in your 'file.tf' (if it contains the soft link to variables.tf) as: -# module.ssh_settings.ssh_key_file -# module.ssh_settings.ssh_key_name - -# e.g. -# -# resource "openstack_compute_instance_v2" "geoserver" { -# key_pair = module.ssh_settings.ssh_key_name - -# 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 - c2_large = "c2.large" #RAM 16 -VCPUs 16 - m1_medium = "m1.medium" #RAM 4 - VCPUs 2 - m1_large = "m1.large" #RAM 8 - VCPUs 4 - m1_xlarge = "m1.xlarge" #RAM 16 - VCPUs 8 - m1_xxl = "m1.xxl" #RAM 32 - VCPUS 16 - m2_small = "m2.small" #RAM 8 - VCPUs 2 - m2_medium = "m2.medium" #RAM 16 - VCPUs 4 - m2_large = "m2.large" #RAM 32 - VCPUs 8 - m3_large = "m3.large" #RAM 64 - VCPUs 16 - } -} - -# Added by Francesco -variable "security_group_list" { - type = map(string) - default = { - postgreSQL = "PostgreSQL service" - acaland = "acaland's dev machine" - haproxy = "traffic_from_main_lb_to_haproxy_l7" - access_to_orientdb = "access_to_orientdb" - dataminer-publish = "dataminer-publish" - docker_swarm_NFS = "Docker Swarm NFS" - public_HTTPS = "Public HTTPS" - orientdb_internal_docker_traffic = "orientdb_internal_docker_traffic" - limited_SSH_access = "Limited SSH access" - debugging_from_jump_node = "debugging_from_jump_node" - access_to_the_timescaledb_service = "access_to_the_timescaledb_service" - docker_swarm = "Docker Swarm" - http_and_https_from_the_load_balancers = "traffic_from_the_main_load_balancers" - limited_HTTPS_access = "restricted_web_service" - mongo = "mongo" - limited_SSH_access = "Limited SSH access" - default = "default" - cassandra = "Cassandra" - access_to_orientdb_se = "access_to_orientdb_se" - } -} - -# Added by Francesco -variable "policy_list" { - type = map(string) - default = { - soft_anti_affinity = "soft-anti-affinity" - anti_affinity = "anti-affinity" - affinity = "affinity" - soft_affinity = "soft-affinity" - } -} - -variable "networks_list" { - type = map(string) - default = { - shared_postgresql = "postgresql-srv-net" - swarm = "swarm-nfs-net" - timescaledb = "timescaledb-net" - orientdb = "orientdb-net" - orientdb_se = "orientdb-se-net" - } -} - -variable "ssh_sources" { - type = map(string) - default = { - s2i2s_vpn_1_cidr = "146.48.28.10/32" - s2i2s_vpn_2_cidr = "146.48.28.11/32" - d4s_vpn_1_cidr = "146.48.122.27/32" - d4s_vpn_2_cidr = "146.48.122.49/32" - shell_d4s_cidr = "146.48.122.95/32" - infrascience_net_cidr = "146.48.122.0/23" - } -} - -variable "networks_with_d4s_services" { - type = map(string) - default = { - "isti_net" = "146.48.80.0/21" - "s2i2s_net" = "146.48.28.0/22" - "infrascience_net" = "146.48.122.0/23" - "garr_ct1_net" = "90.147.166.0/23" - "garr_pa1_net" = "90.147.188.0/23" - "garr_na_net" = "90.147.152.0/24" - } -} - -# variable "default_security_group_name" { -# default = "default_for_all" -# } -