Open theitalianz opened 2 years ago
DNS is resolved just fine anyway, closing.
@theitalianz even we faced same issue.. what is the resolution please ?
@nkm269 I think the A record can be ignored, the fqdn works fine in the internal network. Just try to ping it and it will resolve to the correct internal IP.
theitalianz Thank you the update. Yeah it works fine when we ping it. But any idea why it is creating with the inconsistent name?
@nkm269 not sure tbh. I created a pg flexible via the UI and the name of the A record was consistent with the name given to the server. I'm gonna reopen the issue. You could :+1: if you want to.
Ok.. Yes please reopen the issue.
theitalianz Thank you
Seeing the issue in my environment as well. Need the private a records to be consistent with the fqdn so that I can programmatically pull the IP down from azure and create a public DNS a record to the same IP, for onprem dns resolution. Script breaks when private a record is randomly named.
@theitalianz , thanks for raising this issue.
A record name (b8701f0c730) is automatically generated at backend service by private dns zone service according to some rule. So I assume it's by API design.
The name (b8701f0c730.foo.postgres.database.azure.com.) of private dns zone service you see in azure portal and the fqdn (bar.postgres.database.azure.com) of postgresql flexible server are different thing. So I assume it's by API design.
Is there an update on this bug ? @katbyte
Also seeing this when using Portal to create PostgreSQL flexible server attached to a Private DNS Zone:
However, no issue observed for me, resolving FQDNs from on-premise to Azure (using DNS Private Resolver in our Hub VNet).
I have worked around this issue using below to get the actual private FQDN into TF (data.external.pgsql_fqdn.result.fqdn
):
data "external" "pgsql_fqdn" {
program = ["./fetch_pgsql_fqdn.sh"]
query = {
resource_group_name = azurerm_private_dns_zone.pgsql.resource_group_name
zone_name = azurerm_private_dns_zone.pgsql.name
}
}
Script is:
#!/bin/bash
set -e
eval "$(jq -r '@sh "RG=\(.resource_group_name) ZONE=\(.zone_name)"')"
az network private-dns record-set a list -z $ZONE -g $RG | jq '{"fqdn":.[0].fqdn}'
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_postgresql_flexible_server
Terraform Configuration Files
Debug Output
Panic Output
Expected Behaviour
A record name to be
bar
andfqdn
output to bebar.foo.postgres.database.azure.com
Actual Behaviour
Generated A record has a random name and
fqdn
isbar.postgres.database.azure.com
Steps to Reproduce
terraform apply
Important Factoids
Private DNS and subnet are defined in a separate Terraform modules
References