Skip to content

Instantly share code, notes, and snippets.

@geekzter
Last active May 2, 2021 07:36
Show Gist options
  • Save geekzter/a2d7b3836d1eefbf1bee4a36e7f11658 to your computer and use it in GitHub Desktop.
Save geekzter/a2d7b3836d1eefbf1bee4a36e7f11658 to your computer and use it in GitHub Desktop.
Azure Container Registry Private Endpoint
resource azurerm_private_dns_zone acr {
name = "privatelink.azurecr.io"
resource_group_name = var.resource_group_name
}
resource azurerm_private_dns_zone_virtual_network_link acr {
name = "${var.resource_group_name}-registry-dns-link"
resource_group_name = var.resource_group_name
private_dns_zone_name = azurerm_private_dns_zone.acr.name
virtual_network_id = var.virtual_network_id
}
resource azurerm_private_endpoint acr_endpoint {
name = "${var.resource_group_name}-registry-endpoint"
location = var.location
resource_group_name = var.resource_group_name
subnet_id = var.subnet_id
private_dns_zone_group {
name = azurerm_private_dns_zone.acr.name
private_dns_zone_ids = [azurerm_private_dns_zone.acr.id]
}
private_service_connection {
is_manual_connection = false
name = "${var.resource_group_name}-registry-endpoint-connection"
private_connection_resource_id = var.container_registry_id
subresource_names = ["registry"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment