Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Updated PE schema to latest validated working version #1851

Merged
merged 6 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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[]
}