Skip to content

Commit

Permalink
fix: Updated PE schema to latest validated working version (#1851)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr authored Feb 12, 2025
1 parent 47a2efb commit 1d69fe1
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 18 deletions.
52 changes: 43 additions & 9 deletions docs/static/includes/interfaces/bicep/int.pe.udt.schema1.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ param privateEndpoints privateEndpointSingleServiceType[]?

module >singularMainResourceType<_privateEndpoints 'br/public:avm/res/network/private-endpoint:>version<' = [for (privateEndpoint, index) in (privateEndpoints ?? []): {
name: '${uniqueString(deployment().name, location)}->singularMainResourceType<-PrivateEndpoint-${index}'
scope: !empty(privateEndpoint.?resourceGroupResourceId)
? resourceGroup(
split((privateEndpoint.?resourceGroupResourceId ?? '//'), '/')[2],
split((privateEndpoint.?resourceGroupResourceId ?? '////'), '/')[4]
)
: resourceGroup(
split((privateEndpoint.?subnetResourceId ?? '//'), '/')[2],
split((privateEndpoint.?subnetResourceId ?? '////'), '/')[4]
)
scope: resourceGroup(
split(privateEndpoint.?resourceGroupResourceId ?? privateEndpoint.?subnetResourceId, '/')[2],
split(privateEndpoint.?resourceGroupResourceId ?? privateEndpoint.?subnetResourceId, '/')[4]
)
params: {
// Variant 1: A default service can be assumed (i.e., for services that only have one private endpoint type)
name: privateEndpoint.?name ?? 'pep-${last(split(>singularMainResourceType<.id, '/'))}-${privateEndpoint.?service ?? '>defaultServiceName<'}-${index}'
Expand Down Expand Up @@ -61,3 +56,42 @@ module >singularMainResourceType<_privateEndpoints 'br/public:avm/res/network/pr
customNetworkInterfaceName: privateEndpoint.?customNetworkInterfaceName
}
}]

@description('The private endpoints of the resource.')
output privateEndpoints privateEndpointOutputType[] = [
for (pe, index) in (!empty(privateEndpoints) ? array(privateEndpoints) : []): {
name: >singularMainResourceType<_privateEndpoints[index].outputs.name
resourceId: >singularMainResourceType<_privateEndpoints[index].outputs.resourceId
groupId: >singularMainResourceType<_privateEndpoints[index].outputs.?groupId!
customDnsConfigs: >singularMainResourceType<_privateEndpoints[index].outputs.customDnsConfigs
networkInterfaceResourceIds: >singularMainResourceType<_privateEndpoints[index].outputs.networkInterfaceResourceIds
}
]

// =============== //
// Definitions //
// =============== //

@export()
type privateEndpointOutputType = {
@description('The name of the private endpoint.')
name: string

@description('The resource ID of the private endpoint.')
resourceId: string

@description('The group Id for the private endpoint Group.')
groupId: string?

@description('The custom DNS configurations of the private endpoint.')
customDnsConfigs: {
@description('FQDN that resolves to private endpoint IP address.')
fqdn: string?

@description('A list of private IP addresses of the private endpoint.')
ipAddresses: string[]
}[]

@description('The IDs of the network interfaces associated with the private endpoint.')
networkInterfaceResourceIds: string[]
}
52 changes: 43 additions & 9 deletions docs/static/includes/interfaces/bicep/int.pe.udt.schema2.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ param privateEndpoints privateEndpointMultiServiceType[]?

module >singularMainResourceType<_privateEndpoints 'br/public:avm/res/network/private-endpoint:>version<' = [for (privateEndpoint, index) in (privateEndpoints ?? []): {
name: '${uniqueString(deployment().name, location)}->singularMainResourceType<-PrivateEndpoint-${index}'
scope: !empty(privateEndpoint.?resourceGroupResourceId)
? resourceGroup(
split((privateEndpoint.?resourceGroupResourceId ?? '//'), '/')[2],
split((privateEndpoint.?resourceGroupResourceId ?? '////'), '/')[4]
)
: resourceGroup(
split((privateEndpoint.?subnetResourceId ?? '//'), '/')[2],
split((privateEndpoint.?subnetResourceId ?? '////'), '/')[4]
)
scope: resourceGroup(
split(privateEndpoint.?resourceGroupResourceId ?? privateEndpoint.?subnetResourceId, '/')[2],
split(privateEndpoint.?resourceGroupResourceId ?? privateEndpoint.?subnetResourceId, '/')[4]
)
params: {
// Variant 2: A default service cannot be assumed (i.e., for services that have more than one private endpoint type, like Storage Account)
name: privateEndpoint.?name ?? 'pep-${last(split(>singularMainResourceType<.id, '/'))}-${privateEndpoint.service}-${index}'
Expand Down Expand Up @@ -61,3 +56,42 @@ module >singularMainResourceType<_privateEndpoints 'br/public:avm/res/network/pr
customNetworkInterfaceName: privateEndpoint.?customNetworkInterfaceName
}
}]

@description('The private endpoints of the resource.')
output privateEndpoints privateEndpointOutputType[] = [
for (pe, index) in (!empty(privateEndpoints) ? array(privateEndpoints) : []): {
name: >singularMainResourceType<_privateEndpoints[index].outputs.name
resourceId: >singularMainResourceType<_privateEndpoints[index].outputs.resourceId
groupId: >singularMainResourceType<_privateEndpoints[index].outputs.?groupId!
customDnsConfigs: >singularMainResourceType<_privateEndpoints[index].outputs.customDnsConfigs
networkInterfaceResourceIds: >singularMainResourceType<_privateEndpoints[index].outputs.networkInterfaceResourceIds
}
]

// =============== //
// Definitions //
// =============== //

@export()
type privateEndpointOutputType = {
@description('The name of the private endpoint.')
name: string

@description('The resource ID of the private endpoint.')
resourceId: string

@description('The group Id for the private endpoint Group.')
groupId: string?

@description('The custom DNS configurations of the private endpoint.')
customDnsConfigs: {
@description('FQDN that resolves to private endpoint IP address.')
fqdn: string?

@description('A list of private IP addresses of the private endpoint.')
ipAddresses: string[]
}[]

@description('The IDs of the network interfaces associated with the private endpoint.')
networkInterfaceResourceIds: string[]
}

0 comments on commit 1d69fe1

Please sign in to comment.