Skip to content

Commit

Permalink
fix: Corrected private endpoin name
Browse files Browse the repository at this point in the history
  • Loading branch information
13archit committed May 31, 2023
1 parent 5706caf commit acef83a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
9 changes: 5 additions & 4 deletions _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ module "subnet" {
}

module "container-registry" {
source = "clouddrove/acr/azure"
source = "../"
name = "test-acr"
environment = "test"
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location

Expand All @@ -59,9 +61,8 @@ module "container-registry" {
}

# to enable private endpoint.
virtual_network_id = join("", module.vnet.vnet_id)
subnet_id = module.subnet.default_subnet_id
private_subnet_address_prefix = module.subnet.default_subnet_address_prefixes
virtual_network_id = join("", module.vnet.vnet_id)
subnet_id = module.subnet.default_subnet_id

########Following to be uncommnented only when using DNS Zone from different subscription along with existing DNS zone.

Expand Down
17 changes: 6 additions & 11 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,14 @@ locals {

resource "azurerm_private_endpoint" "pep1" {
count = var.enable && var.enable_private_endpoint ? 1 : 0
name = format("%s-private-endpoint", var.container_registry_config.name)
name = format("%s-pe-acr", module.labels.id)
location = var.location
resource_group_name = var.resource_group_name
subnet_id = join("", var.subnet_id)
private_dns_zone_group {
name = "container-registry-group"
private_dns_zone_ids = [azurerm_private_dns_zone.dnszone1.0.id]
}

private_service_connection {
name = "containerregistryprivatelink"
is_manual_connection = false
private_connection_resource_id = azurerm_container_registry.main.*.id
private_connection_resource_id = azurerm_container_registry.main[0].id
subresource_names = ["registry"]
}
lifecycle {
Expand All @@ -172,17 +167,17 @@ resource "azurerm_private_dns_zone" "dnszone1" {
count = var.enable && var.existing_private_dns_zone == null && var.enable_private_endpoint ? 1 : 0
name = var.private_dns_name
resource_group_name = var.resource_group_name
tags = merge({ "Name" = format("%s", "Azure-Container-Registry-Private-DNS-Zone") }, module.labels.tags, )
tags = module.labels.tags
}

resource "azurerm_private_dns_zone_virtual_network_link" "vent-link1" {
count = var.enable && var.existing_private_dns_zone == null && var.enable_private_endpoint ? 1 : 0
name = "vnet-private-zone-link"
count = var.enable && var.enable_private_endpoint && var.diff_sub == false ? 1 : 0
name = var.existing_private_dns_zone == null ? format("%s-pdz-vnet-link-acr", module.labels.id) : format("%s-pdz-vnet-link-acr-1", module.labels.id)
resource_group_name = local.valid_rg_name
private_dns_zone_name = local.private_dns_zone_name
virtual_network_id = var.virtual_network_id
registration_enabled = var.private_dns_zone_vnet_link_registration_enabled
tags = merge({ "Name" = format("%s", "vnet-private-zone-link") }, module.labels.tags, )
tags = module.labels.tags
}


Expand Down

0 comments on commit acef83a

Please sign in to comment.