Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #93 from Azure/issue/92
Browse files Browse the repository at this point in the history
When user provides a private DNS zone we assume it is already linked to the vnet
  • Loading branch information
soferreira authored Sep 25, 2024
2 parents 908b2ca + 6c0750c commit 3d0daff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions private_endpoint.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
locals {
private_dns_zone_id = length(var.private_endpoint) > 0 ? try(azurerm_private_dns_zone.dns_zone[0].id, data.azurerm_private_dns_zone.dns_zone[0].id) : null
private_dns_zone_name = length(var.private_endpoint) > 0 ? try(azurerm_private_dns_zone.dns_zone[0].name, data.azurerm_private_dns_zone.dns_zone[0].name) : null
private_dns_zone_id = length(var.private_endpoint) > 0 ? try(azurerm_private_dns_zone.dns_zone[0].id, data.azurerm_private_dns_zone.dns_zone[0].id) : null
private_dns_zone_name = length(var.private_endpoint) > 0 ? try(azurerm_private_dns_zone.dns_zone[0].name, data.azurerm_private_dns_zone.dns_zone[0].name) : null
private_endpoint_links = length(var.private_endpoint) > 0 && var.private_dns_zone == null ? var.private_endpoint : {}
}

resource "azurerm_private_endpoint" "this" {
Expand Down Expand Up @@ -62,7 +63,7 @@ resource "azurerm_private_dns_zone" "dns_zone" {
}

resource "azurerm_private_dns_zone_virtual_network_link" "dns_zone_link" {
for_each = var.private_endpoint
for_each = local.private_endpoint_links

name = each.value.dns_zone_virtual_network_link_name
private_dns_zone_name = local.private_dns_zone_name
Expand Down

0 comments on commit 3d0daff

Please sign in to comment.