Added module dns_resources. Using it into geonetwork project
This commit is contained in:
parent
0da976e4c1
commit
c9a0c6d6b2
|
@ -184,3 +184,26 @@ module "instance_with_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 = {
|
||||
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]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
output "dns_resources_map" {
|
||||
value = var.dns_resources_map
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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 = []
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue