Skip to content

Commit

Permalink
feat: Update PE implementation in alignment to latest schema (5) (#1092)
Browse files Browse the repository at this point in the history
## Description


Follow up to #1070
- Applied latest PE schema accross all modules
- Ensured that all modules deploy at least 2 PEs to wnsure there is no
concurrency issue
- Removed several dedicated `private-endpoint` tests cases if already
implemented in max

## Pipeline Reference
| Pipeline |
| - |

[![avm.res.databricks.workspace](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.databricks.workspace.yml/badge.svg?branch=feat%2Fpe-adjustments-962-946-1042_5&event=workflow_dispatch)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.databricks.workspace.yml)

[![avm.res.synapse.workspace](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.synapse.workspace.yml/badge.svg?branch=feat%2Fpe-adjustments-962-946-1042_5&event=workflow_dispatch)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.synapse.workspace.yml)

## Type of Change

<!-- Use the check-boxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utlities (Non-module effecting
changes)
- [x] Azure Verified Module updates:
- [x] Bugfix containing backwards compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [x] Update to documentation

---------

Co-authored-by: Sebastian Gräf <[email protected]>
Co-authored-by: Kris Baranek <[email protected]>
Co-authored-by: ChrisSidebotham-MSFT <[email protected]>
  • Loading branch information
4 people authored Mar 19, 2024
1 parent 308f4e3 commit 98038bb
Show file tree
Hide file tree
Showing 19 changed files with 364 additions and 150 deletions.
52 changes: 39 additions & 13 deletions avm/res/databricks/workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,20 @@ module workspace 'br/public:avm/res/databricks/workspace:<version>' = {
privateDnsZoneResourceIds: [
'<privateDNSZoneResourceId>'
]
service: 'databricks_ui_api'
subnetResourceId: '<subnetResourceId>'
tags: {
Environment: 'Non-Prod'
Role: 'DeploymentValidation'
}
}
{
privateDnsZoneResourceIds: [
'<privateDNSZoneResourceId>'
]
service: 'browser_authentication'
subnetResourceId: '<subnetResourceId>'
}
]
publicIpName: 'nat-gw-public-ip'
publicNetworkAccess: 'Disabled'
Expand Down Expand Up @@ -280,11 +288,19 @@ module workspace 'br/public:avm/res/databricks/workspace:<version>' = {
"privateDnsZoneResourceIds": [
"<privateDNSZoneResourceId>"
],
"service": "databricks_ui_api",
"subnetResourceId": "<subnetResourceId>",
"tags": {
"Environment": "Non-Prod",
"Role": "DeploymentValidation"
}
},
{
"privateDnsZoneResourceIds": [
"<privateDNSZoneResourceId>"
],
"service": "browser_authentication",
"subnetResourceId": "<subnetResourceId>"
}
]
},
Expand Down Expand Up @@ -407,6 +423,7 @@ module workspace 'br/public:avm/res/databricks/workspace:<version>' = {
privateDnsZoneResourceIds: [
'<privateDNSZoneResourceId>'
]
service: 'databricks_ui_api'
subnetResourceId: '<subnetResourceId>'
tags: {
Environment: 'Non-Prod'
Expand Down Expand Up @@ -525,6 +542,7 @@ module workspace 'br/public:avm/res/databricks/workspace:<version>' = {
"privateDnsZoneResourceIds": [
"<privateDNSZoneResourceId>"
],
"service": "databricks_ui_api",
"subnetResourceId": "<subnetResourceId>",
"tags": {
"Environment": "Non-Prod",
Expand Down Expand Up @@ -980,6 +998,7 @@ Configuration details for private endpoints. For security reasons, it is recomme

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`service`](#parameter-privateendpointsservice) | string | The subresource to deploy the private endpoint for. For example "blob", "table", "queue" or "file". |
| [`subnetResourceId`](#parameter-privateendpointssubnetresourceid) | string | Resource ID of the subnet where the endpoint needs to be created. |

**Optional parameters**
Expand All @@ -991,16 +1010,23 @@ Configuration details for private endpoints. For security reasons, it is recomme
| [`customNetworkInterfaceName`](#parameter-privateendpointscustomnetworkinterfacename) | string | The custom name of the network interface attached to the private endpoint. |
| [`enableTelemetry`](#parameter-privateendpointsenabletelemetry) | bool | Enable/Disable usage telemetry for module. |
| [`ipConfigurations`](#parameter-privateendpointsipconfigurations) | array | A list of IP configurations of the private endpoint. This will be used to map to the First Party Service endpoints. |
| [`isManualConnection`](#parameter-privateendpointsismanualconnection) | bool | If Manual Private Link Connection is required. |
| [`location`](#parameter-privateendpointslocation) | string | The location to deploy the private endpoint to. |
| [`lock`](#parameter-privateendpointslock) | object | Specify the type of lock. |
| [`manualPrivateLinkServiceConnections`](#parameter-privateendpointsmanualprivatelinkserviceconnections) | array | Manual PrivateLink Service Connections. |
| [`manualConnectionRequestMessage`](#parameter-privateendpointsmanualconnectionrequestmessage) | string | A message passed to the owner of the remote resource with the manual connection request. |
| [`name`](#parameter-privateendpointsname) | string | The name of the private endpoint. |
| [`privateDnsZoneGroupName`](#parameter-privateendpointsprivatednszonegroupname) | string | The name of the private DNS zone group to create if `privateDnsZoneResourceIds` were provided. |
| [`privateDnsZoneResourceIds`](#parameter-privateendpointsprivatednszoneresourceids) | array | The private DNS zone groups to associate the private endpoint with. A DNS zone group can support up to 5 DNS zones. |
| [`roleAssignments`](#parameter-privateendpointsroleassignments) | array | Array of role assignments to create. |
| [`service`](#parameter-privateendpointsservice) | string | The service (sub-) type to deploy the private endpoint for. For example "vault" or "blob". |
| [`tags`](#parameter-privateendpointstags) | object | Tags to be applied on all resources/resource groups in this deployment. |

### Parameter: `privateEndpoints.service`

The subresource to deploy the private endpoint for. For example "blob", "table", "queue" or "file".

- Required: Yes
- Type: string

### Parameter: `privateEndpoints.subnetResourceId`

Resource ID of the subnet where the endpoint needs to be created.
Expand Down Expand Up @@ -1114,6 +1140,13 @@ A private IP address obtained from the private endpoint's subnet.
- Required: Yes
- Type: string

### Parameter: `privateEndpoints.isManualConnection`

If Manual Private Link Connection is required.

- Required: No
- Type: bool

### Parameter: `privateEndpoints.location`

The location to deploy the private endpoint to.
Expand Down Expand Up @@ -1157,12 +1190,12 @@ Specify the name of lock.
- Required: No
- Type: string

### Parameter: `privateEndpoints.manualPrivateLinkServiceConnections`
### Parameter: `privateEndpoints.manualConnectionRequestMessage`

Manual PrivateLink Service Connections.
A message passed to the owner of the remote resource with the manual connection request.

- Required: No
- Type: array
- Type: string

### Parameter: `privateEndpoints.name`

Expand Down Expand Up @@ -1274,13 +1307,6 @@ The principal type of the assigned principal ID.
]
```

### Parameter: `privateEndpoints.service`

The service (sub-) type to deploy the private endpoint for. For example "vault" or "blob".

- Required: No
- Type: string

### Parameter: `privateEndpoints.tags`

Tags to be applied on all resources/resource groups in this deployment.
Expand Down Expand Up @@ -1491,7 +1517,7 @@ This section gives you an overview of all local-referenced module files (i.e., o

| Reference | Type |
| :-- | :-- |
| `br/public:avm/res/network/private-endpoint:0.3.3` | Remote reference |
| `br/public:avm/res/network/private-endpoint:0.4.0` | Remote reference |

## Notes

Expand Down
41 changes: 28 additions & 13 deletions avm/res/databricks/workspace/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,34 @@ resource workspace_roleAssignments 'Microsoft.Authorization/roleAssignments@2022
scope: workspace
}]

module workspace_privateEndpoints 'br/public:avm/res/network/private-endpoint:0.3.3' = [for (privateEndpoint, index) in (privateEndpoints ?? []): {
@batchSize(1)
module workspace_privateEndpoints 'br/public:avm/res/network/private-endpoint:0.4.0' = [for (privateEndpoint, index) in (privateEndpoints ?? []): {
name: '${uniqueString(deployment().name, location)}-Databricks-PrivateEndpoint-${index}'
params: {
privateLinkServiceConnections: [
name: privateEndpoint.?name ?? 'pep-${last(split(workspace.id, '/'))}-${privateEndpoint.service}-${index}'
privateLinkServiceConnections: privateEndpoint.?manualPrivateLinkServiceConnections != true ? [
{
name: name
name: privateEndpoint.?privateLinkServiceConnectionName ?? '${last(split(workspace.id, '/'))}-${privateEndpoint.service}-${index}'
properties: {
privateLinkServiceId: workspace.id
groupIds: [
privateEndpoint.?service ?? 'databricks_ui_api'
privateEndpoint.service
]
}
}
]
name: privateEndpoint.?name ?? 'pep-${last(split(workspace.id, '/'))}-${privateEndpoint.?service ?? 'databricks_ui_api'}-${index}'
] : null
manualPrivateLinkServiceConnections: privateEndpoint.?manualPrivateLinkServiceConnections == true ? [
{
name: privateEndpoint.?privateLinkServiceConnectionName ?? '${last(split(workspace.id, '/'))}-${privateEndpoint.service}-${index}'
properties: {
privateLinkServiceId: workspace.id
groupIds: [
privateEndpoint.service
]
requestMessage: privateEndpoint.?manualConnectionRequestMessage ?? 'Manual approval required.'
}
}
] : null
subnetResourceId: privateEndpoint.subnetResourceId
enableTelemetry: privateEndpoint.?enableTelemetry ?? enableTelemetry
location: privateEndpoint.?location ?? reference(split(privateEndpoint.subnetResourceId, '/subnets/')[0], '2020-06-01', 'Full').location
Expand All @@ -310,7 +323,6 @@ module workspace_privateEndpoints 'br/public:avm/res/network/private-endpoint:0.
privateDnsZoneResourceIds: privateEndpoint.?privateDnsZoneResourceIds
roleAssignments: privateEndpoint.?roleAssignments
tags: privateEndpoint.?tags ?? tags
manualPrivateLinkServiceConnections: privateEndpoint.?manualPrivateLinkServiceConnections
customDnsConfigs: privateEndpoint.?customDnsConfigs
ipConfigurations: privateEndpoint.?ipConfigurations
applicationSecurityGroupResourceIds: privateEndpoint.?applicationSecurityGroupResourceIds
Expand Down Expand Up @@ -361,15 +373,14 @@ type lockType = {
}?

type privateEndpointType = {

@description('Optional. The name of the private endpoint.')
name: string?

@description('Optional. The location to deploy the private endpoint to.')
location: string?

@description('Optional. The service (sub-) type to deploy the private endpoint for. For example "vault" or "blob".')
service: string?
@description('Required. The subresource to deploy the private endpoint for. For example "blob", "table", "queue" or "file".')
service: string

@description('Required. Resource ID of the subnet where the endpoint needs to be created.')
subnetResourceId: string
Expand All @@ -380,6 +391,13 @@ type privateEndpointType = {
@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('Optional. If Manual Private Link Connection is required.')
isManualConnection: bool?

@description('Optional. A message passed to the owner of the remote resource with the manual connection request.')
@maxLength(140)
manualConnectionRequestMessage: string?

@description('Optional. Custom DNS configurations.')
customDnsConfigs: {
@description('Required. Fqdn that resolves to private endpoint IP address.')
Expand Down Expand Up @@ -422,9 +440,6 @@ type privateEndpointType = {
@description('Optional. Tags to be applied on all resources/resource groups in this deployment.')
tags: object?

@description('Optional. Manual PrivateLink Service Connections.')
manualPrivateLinkServiceConnections: array?

@description('Optional. Enable/Disable usage telemetry for module.')
enableTelemetry: bool?
}[]?
Expand Down
64 changes: 33 additions & 31 deletions avm/res/databricks/workspace/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.25.53.49325",
"templateHash": "7710672223855991692"
"version": "0.26.54.24096",
"templateHash": "8925128185589273318"
},
"name": "Azure Databricks Workspaces",
"description": "This module deploys an Azure Databricks Workspace.",
Expand Down Expand Up @@ -59,9 +59,8 @@
},
"service": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The service (sub-) type to deploy the private endpoint for. For example \"vault\" or \"blob\"."
"description": "Required. The subresource to deploy the private endpoint for. For example \"blob\", \"table\", \"queue\" or \"file\"."
}
},
"subnetResourceId": {
Expand All @@ -87,6 +86,21 @@
"description": "Optional. The private DNS zone groups to associate the private endpoint with. A DNS zone group can support up to 5 DNS zones."
}
},
"isManualConnection": {
"type": "bool",
"nullable": true,
"metadata": {
"description": "Optional. If Manual Private Link Connection is required."
}
},
"manualConnectionRequestMessage": {
"type": "string",
"nullable": true,
"maxLength": 140,
"metadata": {
"description": "Optional. A message passed to the owner of the remote resource with the manual connection request."
}
},
"customDnsConfigs": {
"type": "array",
"items": {
Expand Down Expand Up @@ -195,13 +209,6 @@
"description": "Optional. Tags to be applied on all resources/resource groups in this deployment."
}
},
"manualPrivateLinkServiceConnections": {
"type": "array",
"nullable": true,
"metadata": {
"description": "Optional. Manual PrivateLink Service Connections."
}
},
"enableTelemetry": {
"type": "bool",
"nullable": true,
Expand Down Expand Up @@ -814,7 +821,9 @@
"workspace_privateEndpoints": {
"copy": {
"name": "workspace_privateEndpoints",
"count": "[length(coalesce(parameters('privateEndpoints'), createArray()))]"
"count": "[length(coalesce(parameters('privateEndpoints'), createArray()))]",
"mode": "serial",
"batchSize": 1
},
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
Expand All @@ -825,22 +834,11 @@
},
"mode": "Incremental",
"parameters": {
"privateLinkServiceConnections": {
"value": [
{
"name": "[parameters('name')]",
"properties": {
"privateLinkServiceId": "[resourceId('Microsoft.Databricks/workspaces', parameters('name'))]",
"groupIds": [
"[coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'service'), 'databricks_ui_api')]"
]
}
}
]
},
"name": {
"value": "[coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'name'), format('pep-{0}-{1}-{2}', last(split(resourceId('Microsoft.Databricks/workspaces', parameters('name')), '/')), coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'service'), 'databricks_ui_api'), copyIndex()))]"
"value": "[coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'name'), format('pep-{0}-{1}-{2}', last(split(resourceId('Microsoft.Databricks/workspaces', parameters('name')), '/')), coalesce(parameters('privateEndpoints'), createArray())[copyIndex()].service, copyIndex()))]"
},
"privateLinkServiceConnections": "[if(not(equals(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'manualPrivateLinkServiceConnections'), true())), createObject('value', createArray(createObject('name', coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'privateLinkServiceConnectionName'), format('{0}-{1}-{2}', last(split(resourceId('Microsoft.Databricks/workspaces', parameters('name')), '/')), coalesce(parameters('privateEndpoints'), createArray())[copyIndex()].service, copyIndex())), 'properties', createObject('privateLinkServiceId', resourceId('Microsoft.Databricks/workspaces', parameters('name')), 'groupIds', createArray(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()].service))))), createObject('value', null()))]",
"manualPrivateLinkServiceConnections": "[if(equals(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'manualPrivateLinkServiceConnections'), true()), createObject('value', createArray(createObject('name', coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'privateLinkServiceConnectionName'), format('{0}-{1}-{2}', last(split(resourceId('Microsoft.Databricks/workspaces', parameters('name')), '/')), coalesce(parameters('privateEndpoints'), createArray())[copyIndex()].service, copyIndex())), 'properties', createObject('privateLinkServiceId', resourceId('Microsoft.Databricks/workspaces', parameters('name')), 'groupIds', createArray(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()].service), 'requestMessage', coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'manualConnectionRequestMessage'), 'Manual approval required.'))))), createObject('value', null()))]",
"subnetResourceId": {
"value": "[coalesce(parameters('privateEndpoints'), createArray())[copyIndex()].subnetResourceId]"
},
Expand All @@ -865,9 +863,6 @@
"tags": {
"value": "[coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'tags'), parameters('tags'))]"
},
"manualPrivateLinkServiceConnections": {
"value": "[tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'manualPrivateLinkServiceConnections')]"
},
"customDnsConfigs": {
"value": "[tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'customDnsConfigs')]"
},
Expand All @@ -889,7 +884,7 @@
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "5518855230364102370"
"templateHash": "2592884001616184297"
},
"name": "Private Endpoints",
"description": "This module deploys a Private Endpoint.",
Expand Down Expand Up @@ -1254,7 +1249,7 @@
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"name": "[format('46d3xbcp.res.network-privateendpoint.{0}.{1}', replace('0.3.3', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"name": "[format('46d3xbcp.res.network-privateendpoint.{0}.{1}', replace('0.4.0', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"properties": {
"mode": "Incremental",
"template": {
Expand Down Expand Up @@ -1471,6 +1466,13 @@
"description": "The location the resource was deployed into."
},
"value": "[reference('privateEndpoint', '2023-04-01', 'full').location]"
},
"groupId": {
"type": "string",
"metadata": {
"description": "The group Id for the private endpoint Group."
},
"value": "[if(not(empty(reference('privateEndpoint').manualPrivateLinkServiceConnections)), reference('privateEndpoint').manualPrivateLinkServiceConnections[0].properties.groupIds[0], reference('privateEndpoint').privateLinkServiceConnections[0].properties.groupIds[0])]"
}
}
}
Expand Down
Loading

0 comments on commit 98038bb

Please sign in to comment.