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:
parent
d12748cb96
commit
2185af67c5
28
modules/cadolesDNS/main.tf
Normal file
28
modules/cadolesDNS/main.tf
Normal 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 ]
|
||||
}
|
0
modules/cadolesDNS/outputs.tf
Normal file
0
modules/cadolesDNS/outputs.tf
Normal file
23
modules/cadolesDNS/variables.tf
Normal file
23
modules/cadolesDNS/variables.tf
Normal 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 = []
|
||||
}
|
Loading…
Reference in New Issue
Block a user