I want to create a private link for postgres database. The config shown in the screenshot is exactly I want to configure suing TERRAFORM but could not find any solution.
I tried using following TERRAFORM code
resource "azurerm_private_dns_zone" "priv-dns" {
name = var.azurerm_private_dns_zone_name
resource_group_name = var.resource_group_name
}
resource "azurerm_private_dns_zone_virtual_network_link" "priv-dns-link" {
name = "priv-dns-link"
resource_group_name = var.resource_group_name
private_dns_zone_name = azurerm_private_dns_zone.priv-dns.name
virtual_network_id = var.virtual_network_id
registration_enabled = true
}
resource "azurerm_private_endpoint" "sql_postgres" {
name = var.postgresql_private_endpoint
location = var.location
resource_group_name = var.resource_group_name
subnet_id = var.data_subnet_id
private_service_connection {
name = var.postgresql_private_link
private_connection_resource_id = azurerm_postgresql_server.postgresql.id
subresource_names = ["postgresqlServer"]
is_manual_connection = false
}
private_dns_zone_group {
name = "dns-group"
private_dns_zone_ids = [ azurerm_private_dns_zone.priv-dns.id ]
}
}
I end up getting below DNS config which doesn't work