Added module dns_resources. Using it into geonetwork project

This commit is contained in:
Francesco Mangiacrapa 2024-01-16 11:03:06 +01:00
parent 0da976e4c1
commit c9a0c6d6b2
5 changed files with 109 additions and 33 deletions

View File

@ -36,9 +36,9 @@ module "instance_with_data_volume" {
server_groups_ids = [],
image_ref = module.common_variables.ubuntu_1804
volume = {
name = "geonetwork_ariadne_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_ariadne_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_fisherieatlas = {
@ -50,9 +50,9 @@ module "instance_with_data_volume" {
server_groups_ids = [],
image_ref = module.common_variables.ubuntu_1804
volume = {
name = "geonetwork_fisherieatlas_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_fisherieatlas_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_grsf = {
@ -64,9 +64,9 @@ module "instance_with_data_volume" {
server_groups_ids = [],
image_ref = module.common_variables.ubuntu_1804
volume = {
name = "geonetwork_grsf_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_grsf_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_iotcss3 = {
@ -79,9 +79,9 @@ module "instance_with_data_volume" {
server_groups_ids = [],
image_ref = module.common_variables.ubuntu_1804
volume = {
name = "geonetwork_iotcss3_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_iotcss3_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_sdilab = {
@ -93,9 +93,9 @@ module "instance_with_data_volume" {
server_groups_ids = [],
image_ref = module.common_variables.ubuntu_1804
volume = {
name = "geonetwork_sdilab_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_sdilab_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_spatialdata = {
@ -107,9 +107,9 @@ module "instance_with_data_volume" {
image_ref = module.common_variables.ubuntu_1804
server_groups_ids = [],
volume = {
name = "geonetwork_spatialdata_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_spatialdata_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_wecafcfirms = {
@ -121,9 +121,9 @@ module "instance_with_data_volume" {
image_ref = module.common_variables.ubuntu_1804
server_groups_ids = [],
volume = {
name = "geonetwork_wecafcfirms_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_wecafcfirms_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_bluecloud = {
@ -135,9 +135,9 @@ module "instance_with_data_volume" {
image_ref = module.common_variables.ubuntu_1804
server_groups_ids = [],
volume = {
name = "geonetwork_bluecloud_data_volume",
size = "30",
device = "/dev/vdb"
name = "geonetwork_bluecloud_data_volume",
size = "30",
device = "/dev/vdb"
}
},
geonetwork_tunaatlas = {
@ -149,9 +149,9 @@ module "instance_with_data_volume" {
image_ref = module.common_variables.ubuntu_1804
server_groups_ids = [],
volume = {
name = "geonetwork_tunaatlas_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_tunaatlas_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_globalfisheriesatlas = {
@ -163,9 +163,9 @@ module "instance_with_data_volume" {
image_ref = module.common_variables.ubuntu_1804
server_groups_ids = [],
volume = {
name = "geonetwork_globalfisheriesatlas_data_volume",
size = "20",
device = "/dev/vdb"
name = "geonetwork_globalfisheriesatlas_data_volume",
size = "20",
device = "/dev/vdb"
}
},
geonetwork_prod = {
@ -177,10 +177,33 @@ module "instance_with_data_volume" {
image_ref = module.common_variables.ubuntu_1804
server_groups_ids = [],
volume = {
name = "geonetwork_prod_data_volume",
size = "40",
device = "/dev/vdb"
name = "geonetwork_prod_data_volume",
size = "40",
device = "/dev/vdb"
}
}
}
}
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 = {
geonetwork-globalfisheriesatlas = {
zone_id = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone_id
name = join(".", ["geonetwork-globalfisheriesatlas", data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name])
description = "Geonetwork geonetwork-globalfisheriesatlas"
ttl = 8600
type = "CNAME"
records = [local.cname_target]
}
}
}

View File

@ -0,0 +1,15 @@
# Module used
module "ssh_settings" {
source = "../../modules/ssh-key-ref"
}
resource "openstack_dns_recordset_v2" "add_dns_recordset" {
for_each = var.dns_resources_map
zone_id = each.value.zone_id
name = each.value.name
description = each.value.description
ttl = each.value.ttl
type = each.value.type
records = each.value.records
}

View File

@ -0,0 +1,4 @@
output "dns_resources_map" {
value = var.dns_resources_map
}

View File

@ -0,0 +1,11 @@
# Define required providers
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.53.0"
}
}
}

View File

@ -0,0 +1,23 @@
#Default DNS resource is EMPTY. Override it to create a proper plan
variable "dns_resources_map" {
type = map(object({
zone_id = string
name = string
description = string
ttl = number
type = string
records = list(string)
}))
default = {
dns_record = {
zone_id = ""
name = "",
description = "",
ttl = 8600,
type = "CNAME",
records = []
}
}
}