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: Private Endpoint updated NIC resourceID & groupID output #3606

Merged
4 changes: 2 additions & 2 deletions avm/res/network/private-endpoint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1270,11 +1270,11 @@ Tags to be applied on all resources/resource groups in this deployment.

| Output | Type | Description |
| :-- | :-- | :-- |
| `customDnsConfig` | | The custom DNS configurations of the private endpoint. |
| `customDnsConfig` | array | The custom DNS configurations of the private endpoint. |
| `groupId` | string | The group Id for the private endpoint Group. |
| `location` | string | The location the resource was deployed into. |
| `name` | string | The name of the private endpoint. |
| `networkInterfaceIds` | array | The IDs of the network interfaces associated with the private endpoint. |
| `networkInterfaceResourceIds` | array | The resource IDs of the network interfaces associated with the private endpoint. |
| `resourceGroupName` | string | The resource group the private endpoint was deployed into. |
| `resourceId` | string | The resource ID of the private endpoint. |

Expand Down
81 changes: 25 additions & 56 deletions avm/res/network/private-endpoint/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,39 @@ param name string
param subnetResourceId string

@description('Optional. Application security groups in which the private endpoint IP configuration is included.')
param applicationSecurityGroupResourceIds array?
param applicationSecurityGroupResourceIds string[]?

@description('Optional. The custom name of the network interface attached to the private endpoint.')
param customNetworkInterfaceName string?

@description('Optional. A list of IP configurations of the private endpoint. This will be used to map to the First Party Service endpoints.')
param ipConfigurations ipConfigurationsType
param ipConfigurations ipConfigurationType[]?

@description('Optional. The private DNS zone group to configure for the private endpoint.')
param privateDnsZoneGroup privateDnsZoneGroupType?

@description('Optional. Location for all Resources.')
param location string = resourceGroup().location

import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.2.1'
@description('Optional. The lock settings of the service.')
param lock lockType
param lock lockType?

import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.2.1'
@description('Optional. Array of role assignments to create.')
param roleAssignments roleAssignmentType
param roleAssignments roleAssignmentType[]?

@description('Optional. Tags to be applied on all resources/resource groups in this deployment.')
param tags object?

@description('Optional. Custom DNS configurations.')
param customDnsConfigs customDnsConfigType
param customDnsConfigs customDnsConfigType[]?

@description('Optional. A grouping of information about the connection to the remote resource. Used when the network admin does not have access to approve connections to the remote resource.')
param manualPrivateLinkServiceConnections manualPrivateLinkServiceConnectionsType
param manualPrivateLinkServiceConnections manualPrivateLinkServiceConnectionType[]?

@description('Optional. A grouping of information about the connection to the remote resource.')
param privateLinkServiceConnections privateLinkServiceConnectionsType
param privateLinkServiceConnections privateLinkServiceConnectionType[]?

@description('Optional. Enable/Disable usage telemetry for module.')
param enableTelemetry bool = true
Expand Down Expand Up @@ -178,24 +180,21 @@ output name string = privateEndpoint.name
output location string = privateEndpoint.location

@description('The custom DNS configurations of the private endpoint.')
output customDnsConfig customDnsConfigType = privateEndpoint.properties.customDnsConfigs
output customDnsConfig customDnsConfigType[] = privateEndpoint.properties.customDnsConfigs

@description('The IDs of the network interfaces associated with the private endpoint.')
output networkInterfaceIds array = privateEndpoint.properties.networkInterfaces
@description('The resource IDs of the network interfaces associated with the private endpoint.')
output networkInterfaceResourceIds string[] = map(privateEndpoint.properties.networkInterfaces, nic => nic.id)

@description('The group Id for the private endpoint Group.')
output groupId string = !empty(privateEndpoint.properties.manualPrivateLinkServiceConnections) && length(privateEndpoint.properties.manualPrivateLinkServiceConnections[0].properties.?groupIds) > 0
? privateEndpoint.properties.manualPrivateLinkServiceConnections[0].properties.?groupIds[0] ?? ''
: !empty(privateEndpoint.properties.privateLinkServiceConnections) && length(privateEndpoint.properties.privateLinkServiceConnections[0].properties.?groupIds) > 0
? privateEndpoint.properties.privateLinkServiceConnections[0].properties.?groupIds[0] ?? ''
: ''
output groupId string? = privateEndpoint.properties.?manualPrivateLinkServiceConnections[?0].properties.?groupIds[?0] ?? privateEndpoint.properties.?privateLinkServiceConnections[?0].properties.?groupIds[?0]

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

import { privateDnsZoneGroupConfigType } from 'private-dns-zone-group/main.bicep'

@export()
type privateDnsZoneGroupType = {
@description('Optional. The name of the Private DNS Zone Group.')
name: string?
Expand All @@ -204,41 +203,8 @@ type privateDnsZoneGroupType = {
privateDnsZoneGroupConfigs: privateDnsZoneGroupConfigType[]
}

type roleAssignmentType = {
@description('Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated.')
name: string?

@description('Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
roleDefinitionIdOrName: string

@description('Required. The principal ID of the principal (user/group/identity) to assign the role to.')
principalId: string

@description('Optional. The principal type of the assigned principal ID.')
principalType: ('ServicePrincipal' | 'Group' | 'User' | 'ForeignGroup' | 'Device')?

@description('Optional. The description of the role assignment.')
description: string?

@description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".')
condition: string?

@description('Optional. Version of the condition.')
conditionVersion: '2.0'?

@description('Optional. The Resource Id of the delegated managed identity resource.')
delegatedManagedIdentityResourceId: string?
}[]?

type lockType = {
@description('Optional. Specify the name of lock.')
name: string?

@description('Optional. Specify the type of lock.')
kind: ('CanNotDelete' | 'ReadOnly' | 'None')?
}?

type ipConfigurationsType = {
@export()
type ipConfigurationType = {
@description('Required. The name of the resource that is unique within a resource group.')
name: string

Expand All @@ -253,9 +219,10 @@ type ipConfigurationsType = {
@description('Required. A private IP address obtained from the private endpoint\'s subnet.')
privateIPAddress: string
}
}[]?
}

type manualPrivateLinkServiceConnectionsType = {
@export()
type manualPrivateLinkServiceConnectionType = {
@description('Required. The name of the private link service connection.')
name: string

Expand All @@ -270,9 +237,10 @@ type manualPrivateLinkServiceConnectionsType = {
@description('Optional. A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars.')
requestMessage: string?
}
}[]?
}

type privateLinkServiceConnectionsType = {
@export()
type privateLinkServiceConnectionType = {
@description('Required. The name of the private link service connection.')
name: string

Expand All @@ -287,12 +255,13 @@ type privateLinkServiceConnectionsType = {
@description('Optional. A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars.')
requestMessage: string?
}
}[]?
}

@export()
type customDnsConfigType = {
@description('Optional. FQDN that resolves to private endpoint IP address.')
fqdn: string?

@description('Required. A list of private IP addresses of the private endpoint.')
ipAddresses: string[]
}[]?
}
eriqua marked this conversation as resolved.
Show resolved Hide resolved
Loading