feat(module): adding DNS module

This module create entries on a DNS Server with DNSUPDATE.

extracted from "Cadoles Production v2 project"
This commit is contained in:
Philippe Caseiro 2023-01-19 14:14:52 +01:00
parent d12748cb96
commit 2185af67c5
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,28 @@
// Dependencies management
resource "null_resource" "depends_on" {
triggers = {
depends_on = join("", var.depends)
}
}
resource "dns_a_record_set" "a_records" {
for_each = var.dns_a_records
zone = var.dns_domain
name = each.key
ttl = 300
addresses = each.value
depends_on = [ null_resource.depends_on ]
}
resource "dns_cname_record" "cname_records" {
for_each = var.dns_cname_records
zone = var.dns_domain
name = each.key
cname = each.value
ttl = 300
depends_on = [ null_resource.depends_on ]
}

View File

View File

@ -0,0 +1,23 @@
variable "dns_domain" {
description = "DNS Domain name (FQDN)"
type = string
default = "cadoles.com."
}
variable "dns_a_records" {
description = "List of dns A records to create"
type = map
default = {}
}
variable "dns_cname_records" {
description = "List of CNAME entires"
type = map
default = {}
}
variable "depends" {
description = "List of output_variables for dependences management"
type = list
default = []
}