From d238b1d48ac4b4d46d71581f9aedd9028c02f328 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 30 Jan 2024 15:46:34 +0100 Subject: [PATCH] Added DNS CNAME --- openstack-tf/d4s-production/geoportal/main.tf | 24 ++++++++++ .../geoportal/terraform.tfstate | 44 +++++++++++++++++-- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/openstack-tf/d4s-production/geoportal/main.tf b/openstack-tf/d4s-production/geoportal/main.tf index 5a477cc..96b5d05 100644 --- a/openstack-tf/d4s-production/geoportal/main.tf +++ b/openstack-tf/d4s-production/geoportal/main.tf @@ -50,3 +50,27 @@ module "instance_without_data_volume" { } } } + + +locals { + cname_target = "main-lb.${data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name}" +} + +# +# Add DNS record/s +# +module "dns_records_create" { + source = "../../modules/dns_resources" + + dns_resources_map = { + geoportal = { + zone_id = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone_id + name = join(".", ["geoportal", data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name]) + description = "Geoportal CNAME" + ttl = 8600 + type = "CNAME" + records = [local.cname_target] + } + } +} + diff --git a/openstack-tf/d4s-production/geoportal/terraform.tfstate b/openstack-tf/d4s-production/geoportal/terraform.tfstate index 81cda67..14507af 100644 --- a/openstack-tf/d4s-production/geoportal/terraform.tfstate +++ b/openstack-tf/d4s-production/geoportal/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.7.1", - "serial": 3, + "serial": 5, "lineage": "aae5e61d-a5f4-4d02-f728-036c142ce6a7", "outputs": {}, "resources": [ @@ -393,7 +393,9 @@ "schema_version": 0, "attributes": { "id": "7258d5fd-3f4e-46f0-aeb6-95e7deef246b", - "members": [], + "members": [ + "eba131d8-50ec-4e3e-9203-cdc025db210c" + ], "name": "geoportal", "policies": [ "soft-anti-affinity" @@ -411,6 +413,40 @@ } ] }, + { + "module": "module.dns_records_create", + "mode": "managed", + "type": "openstack_dns_recordset_v2", + "name": "add_dns_recordset", + "provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]", + "instances": [ + { + "index_key": "geoportal", + "schema_version": 0, + "attributes": { + "description": "Geoportal CNAME", + "disable_status_check": false, + "id": "74135b34-1a9c-4c01-8cf0-22450a5660c4/2cfa7648-7fdd-42ed-8abb-6f022751d318", + "name": "geoportal.cloud.d4science.org.", + "project_id": "1b45adf388934758b56d0dfdb4bfacf3", + "records": [ + "main-lb.cloud.d4science.org." + ], + "region": "isti_area_pi_1", + "timeouts": null, + "ttl": 8600, + "type": "CNAME", + "value_specs": null, + "zone_id": "74135b34-1a9c-4c01-8cf0-22450a5660c4" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH19", + "dependencies": [ + "data.terraform_remote_state.privnet_dns_router" + ] + } + ] + }, { "module": "module.instance_without_data_volume", "mode": "managed", @@ -484,7 +520,7 @@ "region": "isti_area_pi_1", "scheduler_hints": [ { - "additional_properties": null, + "additional_properties": {}, "build_near_host_ip": "", "different_cell": [], "different_host": [], @@ -500,7 +536,7 @@ "traffic_from_the_main_load_balancers" ], "stop_before_destroy": false, - "tags": null, + "tags": [], "timeouts": null, "updated": "2024-01-30 14:22:36 +0000 UTC", "user_data": "47d4769e61324c305c4b70ed6673de4fad84150d",