Skip to content

Commit

Permalink
ACR - Update Private Endpoints schema
Browse files Browse the repository at this point in the history
  • Loading branch information
krbar committed Sep 6, 2024
1 parent d03d954 commit e393920
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 19 deletions.
35 changes: 27 additions & 8 deletions avm/res/container-registry/registry/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ var builtInRoleNames = {
Contributor: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
Owner: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')
Reader: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')
'Role Based Access Control Administrator (Preview)': subscriptionResourceId(
'Role Based Access Control Administrator': subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions',
'f58310d9-a9f6-439a-9e8d-f62e7b41a168'
)
Expand Down Expand Up @@ -443,7 +443,7 @@ resource registry_roleAssignments 'Microsoft.Authorization/roleAssignments@2022-
}
]

module registry_privateEndpoints 'br/public:avm/res/network/private-endpoint:0.4.1' = [
module registry_privateEndpoints 'br/public:avm/res/network/private-endpoint:0.7.1' = [
for (privateEndpoint, index) in (privateEndpoints ?? []): {
name: '${uniqueString(deployment().name, location)}-registry-PrivateEndpoint-${index}'
scope: resourceGroup(privateEndpoint.?resourceGroupName ?? '')
Expand Down Expand Up @@ -484,8 +484,7 @@ module registry_privateEndpoints 'br/public:avm/res/network/private-endpoint:0.4
'Full'
).location
lock: privateEndpoint.?lock ?? lock
privateDnsZoneGroupName: privateEndpoint.?privateDnsZoneGroupName
privateDnsZoneResourceIds: privateEndpoint.?privateDnsZoneResourceIds
privateDnsZoneGroup: privateEndpoint.?privateDnsZoneGroup
roleAssignments: privateEndpoint.?roleAssignments
tags: privateEndpoint.?tags ?? tags
customDnsConfigs: privateEndpoint.?customDnsConfigs
Expand Down Expand Up @@ -524,6 +523,17 @@ output credentialSetsResourceIds array = [
for index in range(0, length(credentialSets)): registry_credentialSets[index].outputs.resourceId
]

@description('The private endpoints of the Azure container registry.')
output privateEndpoints array = [
for (pe, i) in (!empty(privateEndpoints) ? array(privateEndpoints) : []): {
name: registry_privateEndpoints[i].outputs.name
resourceId: registry_privateEndpoints[i].outputs.resourceId
groupId: registry_privateEndpoints[i].outputs.groupId
customDnsConfig: registry_privateEndpoints[i].outputs.customDnsConfig
networkInterfaceIds: registry_privateEndpoints[i].outputs.networkInterfaceIds
}
]

// =============== //
// Definitions //
// =============== //
Expand Down Expand Up @@ -586,11 +596,20 @@ type privateEndpointType = {
@description('Required. Resource ID of the subnet where the endpoint needs to be created.')
subnetResourceId: string

@description('Optional. The name of the private DNS zone group to create if `privateDnsZoneResourceIds` were provided.')
privateDnsZoneGroupName: string?
@description('Optional. The private DNS zone group to configure for the private endpoint.')
privateDnsZoneGroup: {
@description('Optional. The name of the Private DNS Zone Group.')
name: string?

@description('Required. The private DNS zone groups to associate the private endpoint. A DNS zone group can support up to 5 DNS zones.')
privateDnsZoneGroupConfigs: {
@description('Optional. The name of the private DNS zone group config.')
name: string?

@description('Optional. The private DNS zone groups to associate the private endpoint with. A DNS zone group can support up to 5 DNS zones.')
privateDnsZoneResourceIds: string[]?
@description('Required. The resource id of the private DNS zone.')
privateDnsZoneResourceId: string
}[]
}?

@description('Optional. If Manual Private Link Connection is required.')
isManualConnection: bool?
Expand Down
20 changes: 14 additions & 6 deletions avm/res/container-registry/registry/tests/e2e/max/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ module testDeployment '../../../main.bicep' = [
privateEndpoints: [
{
subnetResourceId: nestedDependencies.outputs.subnetResourceId
privateDnsZoneResourceIds: [
nestedDependencies.outputs.privateDNSZoneResourceId
]
privateDnsZoneGroup: {
privateDnsZoneGroupConfigs: [
{
privateDnsZoneResourceId: nestedDependencies.outputs.privateDNSZoneResourceId
}
]
}
tags: {
'hidden-title': 'This is visible in the resource name'
Environment: 'Non-Prod'
Expand All @@ -107,9 +111,13 @@ module testDeployment '../../../main.bicep' = [
}
{
subnetResourceId: nestedDependencies.outputs.subnetResourceId
privateDnsZoneResourceIds: [
nestedDependencies.outputs.privateDNSZoneResourceId
]
privateDnsZoneGroup: {
privateDnsZoneGroupConfigs: [
{
privateDnsZoneResourceId: nestedDependencies.outputs.privateDNSZoneResourceId
}
]
}
}
]
networkRuleSetIpRules: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ output pairedRegionName string = getPairedRegionScript.properties.outputs.paired
output subnetResourceId string = virtualNetwork.properties.subnets[0].id

@description('The resource ID of the created Private DNS Zone.')
output privateDNSResourceId string = privateDNSZone.id
output privateDNSZoneResourceId string = privateDNSZone.id
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ module testDeployment '../../../main.bicep' = [
}
privateEndpoints: [
{
privateDnsZoneResourceIds: [
nestedDependencies.outputs.privateDNSResourceId
]
privateDnsZoneGroup: {
privateDnsZoneGroupConfigs: [
{
privateDnsZoneResourceId: nestedDependencies.outputs.privateDNSZoneResourceId
}
]
}
subnetResourceId: nestedDependencies.outputs.subnetResourceId
}
]
Expand Down
2 changes: 1 addition & 1 deletion avm/res/container-registry/registry/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.4",
"version": "0.5",
"pathFilters": [
"./main.json"
]
Expand Down

0 comments on commit e393920

Please sign in to comment.