Map-driven record sets for an existing private DNS zone. The private-zone twin of
azure-ptn-network-dnszone-records.
Azure/avm-res-network-privatednszone/azurerm
bundles zone, records and vnet links into one module. That breaks down when the zone and its records are
owned by different configurations, or when records are added to a zone that already exists. This module
takes the zone as an ARM resource ID and creates nothing but records.
It pairs with azure-res-network-privatednszone for the zone and
azure-ptn-network-privatednszone-vnet-links for the
links.
module "records" {
source = "git::https://github.com/emberstack/terraform.git//src/modules/azure-ptn-network-privatednszone-records?ref=vX.Y.Z"
private_dns_zone_resource_id = module.zone.resource_id
private_dns_zone_records = {
api = {
name = "api"
type = "A"
a_records = ["10.0.1.10"]
}
legacy_alias = {
name = "legacy"
type = "CNAME"
cname_record = "api.example.internal"
}
sip = {
name = "_sip._tcp"
type = "SRV"
srv_records = [
{ priority = 10, weight = 60, port = 5060, target = "sip.example.internal" },
]
}
}
}See variables.tf and outputs.tf. Every variable and output
carries a description, and CI enforces that.
type |
Field | Shape |
|---|---|---|
A |
a_records |
list of IPv4 addresses |
AAAA |
aaaa_records |
list of IPv6 addresses |
CNAME |
cname_record |
a single hostname |
MX |
mx_records |
list of {preference, exchange} |
PTR |
ptr_records |
list of hostnames |
SRV |
srv_records |
list of {priority, weight, port, target} |
TXT |
txt_records |
list of TXT string values |
- No NS or CAA records. Azure private DNS does not support those record types, and this module rejects them at validation time rather than letting ARM fail the apply. That is the only interface difference from the public twin.
- State address stability. Each entry creates
azapi_resource.<lowercase type>["<key>"]. Renaming a key, or changing an entry'stype, moves the address and recreates the record set. - Record-set tags live in
properties.metadata, not resourcetags. Per-recordtagswin over the module-leveltagson a key collision. - Lower-case ARM property names. The private-zone API spells the record-set body keys
ttl,aRecords,txtRecords; the public-zone API usesTTL,ARecords,TXTRecords. The two modules look like each other but their bodies are deliberately cased differently, and ARM is case-sensitive here. - Two output shapes.
private_dns_zone_recordsis flat and keyed by your input key, withtypeon each entry;private_dns_zone_records_by_typegroups by record type. Thetypefield is upper-case while the grouping key is lower-case, so the two do not compose directly. - The zone is not created here.
private_dns_zone_resource_idmust already exist; it is validated to be aMicrosoft.Network/privateDnsZonesARM ID.