Skip to content

Commit

Permalink
feat: Add tags and lock support to `avm/ptn/network/private-link-priv…
Browse files Browse the repository at this point in the history
…ate-dns-zones` (#3648)

## Description

Add tags and lock support to
`avm/ptn/network/private-link-private-dns-zones`

## Pipeline Reference

| Pipeline |
| -------- |
|
[![avm.ptn.network.private-link-private-dns-zones](https://github.com/jtracey93/bicep-registry-modules/actions/workflows/avm.ptn.network.private-link-private-dns-zones.yml/badge.svg?branch=feat%2Fadd-tags-etc-pdns-ptn)](https://github.com/jtracey93/bicep-registry-modules/actions/workflows/avm.ptn.network.private-link-private-dns-zones.yml)
|

## Type of Change

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

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [x] Azure Verified Module updates:
- [ ] 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.
- [x] 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`.
  - [ ] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
jtracey93 authored Oct 28, 2024
1 parent 0e49ca4 commit c5c2a03
Show file tree
Hide file tree
Showing 5 changed files with 445 additions and 124 deletions.
78 changes: 77 additions & 1 deletion avm/ptn/network/private-link-private-dns-zones/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,19 @@ module privateLinkPrivateDnsZones 'br/public:avm/ptn/network/private-link-privat
name: 'privateLinkPrivateDnsZonesDeployment'
params: {
location: '<location>'
lock: {
kind: 'CanNotDelete'
name: 'pdnsZonesLock'
}
privateLinkPrivateDnsZones: [
'testpdnszone1.int'
'testpdnszone2.local'
]
tags: {
Environment: 'Example'
'hidden-title': 'This is visible in the resource name'
Role: 'DeploymentValidation'
}
virtualNetworkResourceIdsToLinkTo: [
'<vnetResourceId>'
]
Expand All @@ -129,12 +138,25 @@ module privateLinkPrivateDnsZones 'br/public:avm/ptn/network/private-link-privat
"location": {
"value": "<location>"
},
"lock": {
"value": {
"kind": "CanNotDelete",
"name": "pdnsZonesLock"
}
},
"privateLinkPrivateDnsZones": {
"value": [
"testpdnszone1.int",
"testpdnszone2.local"
]
},
"tags": {
"value": {
"Environment": "Example",
"hidden-title": "This is visible in the resource name",
"Role": "DeploymentValidation"
}
},
"virtualNetworkResourceIdsToLinkTo": {
"value": [
"<vnetResourceId>"
Expand All @@ -155,10 +177,19 @@ module privateLinkPrivateDnsZones 'br/public:avm/ptn/network/private-link-privat
using 'br/public:avm/ptn/network/private-link-private-dns-zones:<version>'
param location = '<location>'
param lock = {
kind: 'CanNotDelete'
name: 'pdnsZonesLock'
}
param privateLinkPrivateDnsZones = [
'testpdnszone1.int'
'testpdnszone2.local'
]
param tags = {
Environment: 'Example'
'hidden-title': 'This is visible in the resource name'
Role: 'DeploymentValidation'
}
param virtualNetworkResourceIdsToLinkTo = [
'<vnetResourceId>'
]
Expand Down Expand Up @@ -234,7 +265,9 @@ param virtualNetworkResourceIdsToLinkTo = [
| :-- | :-- | :-- |
| [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. |
| [`location`](#parameter-location) | string | Azure region where the each of the Private Link Private DNS Zones created will be deployed, default to Resource Group location if not specified. |
| [`lock`](#parameter-lock) | object | The lock settings for the Private Link Private DNS Zones created. |
| [`privateLinkPrivateDnsZones`](#parameter-privatelinkprivatednszones) | array | An array of Private Link Private DNS Zones to create. Each item must be a valid DNS zone name.<p><p>**NOTE:**<p><li>Private Link Private DNS Zones that have `{{regionCode}}` in the name will be replaced with the Geo Code of the Region you specified in the `location` parameter, if available, as documented [here](https://learn.microsoft.com/azure/private-link/private-endpoint-dns#:~:text=Note-,In%20the%20above%20text%2C%20%7BregionCode%7D%20refers%20to%20the%20region%20code%20(for%20example%2C%20eus%20for%20East%20US%20and%20ne%20for%20North%20Europe).%20Refer%20to%20the%20following%20lists%20for%20regions%20codes%3A,-All%20public%20clouds).<p> - e.g. If `UK South` or `uksouth` was specified as the region in the `location` parameter, `{{regionCode}}` would be replaced with `uks` in the Private DNS Zone name.<li>Private Link Private DNS Zones that have `{{regionName}}` in the name will be replaced with the short name of the Region you specified in the `location` parameter, if available, as documented [here](https://learn.microsoft.com/azure/private-link/private-endpoint-dns).<p> - e.g. If `UK South` or `uksouth` was specified as the region in the `location` parameter, `{{regionName}}` would be replaced with `uksouth` in the Private DNS Zone name.<p><p>**IMPORTANT:**<p><p>The folowing Private Link Private DNS Zones have been removed from the default value for this parameter as they require additional placeholders to be replaced that will only be known by the caller of the module at runtime and cannot be determined by the module itself. If you have a requirement to create these Private Link Private DNS Zones, you must provide the full list of Private Link Private DNS Zones to create as an array in the `privateLinkPrivateDnsZones` parameter, using the default value as a reference. The list of Private Link Private DNS Zones that have been removed are:<p><li>`{subzone}.privatelink.{regionName}.azmk8s.io`<li>`privatelink.{dnsPrefix}.database.windows.net`<li>`privatelink.{partitionId}.azurestaticapps.net`<p><p>We have also removed the following Private Link Private DNS Zones from the default value for this parameter as they should only be created and used with in specific scenarios:<p><li>`privatelink.azure.com`.<p> |
| [`tags`](#parameter-tags) | object | Tags of the Private Link Private DNS Zones created. |
| [`virtualNetworkResourceIdsToLinkTo`](#parameter-virtualnetworkresourceidstolinkto) | array | An array of Virtual Network Resource IDs to link to the Private Link Private DNS Zones. Each item must be a valid Virtual Network Resource ID. |

### Parameter: `enableTelemetry`
Expand All @@ -253,6 +286,42 @@ Azure region where the each of the Private Link Private DNS Zones created will b
- Type: string
- Default: `[resourceGroup().location]`

### Parameter: `lock`

The lock settings for the Private Link Private DNS Zones created.

- Required: No
- Type: object

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`kind`](#parameter-lockkind) | string | Specify the type of lock. |
| [`name`](#parameter-lockname) | string | Specify the name of lock. |

### Parameter: `lock.kind`

Specify the type of lock.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'CanNotDelete'
'None'
'ReadOnly'
]
```

### Parameter: `lock.name`

Specify the name of lock.

- Required: No
- Type: string

### Parameter: `privateLinkPrivateDnsZones`

An array of Private Link Private DNS Zones to create. Each item must be a valid DNS zone name.<p><p>**NOTE:**<p><li>Private Link Private DNS Zones that have `{{regionCode}}` in the name will be replaced with the Geo Code of the Region you specified in the `location` parameter, if available, as documented [here](https://learn.microsoft.com/azure/private-link/private-endpoint-dns#:~:text=Note-,In%20the%20above%20text%2C%20%7BregionCode%7D%20refers%20to%20the%20region%20code%20(for%20example%2C%20eus%20for%20East%20US%20and%20ne%20for%20North%20Europe).%20Refer%20to%20the%20following%20lists%20for%20regions%20codes%3A,-All%20public%20clouds).<p> - e.g. If `UK South` or `uksouth` was specified as the region in the `location` parameter, `{{regionCode}}` would be replaced with `uks` in the Private DNS Zone name.<li>Private Link Private DNS Zones that have `{{regionName}}` in the name will be replaced with the short name of the Region you specified in the `location` parameter, if available, as documented [here](https://learn.microsoft.com/azure/private-link/private-endpoint-dns).<p> - e.g. If `UK South` or `uksouth` was specified as the region in the `location` parameter, `{{regionName}}` would be replaced with `uksouth` in the Private DNS Zone name.<p><p>**IMPORTANT:**<p><p>The folowing Private Link Private DNS Zones have been removed from the default value for this parameter as they require additional placeholders to be replaced that will only be known by the caller of the module at runtime and cannot be determined by the module itself. If you have a requirement to create these Private Link Private DNS Zones, you must provide the full list of Private Link Private DNS Zones to create as an array in the `privateLinkPrivateDnsZones` parameter, using the default value as a reference. The list of Private Link Private DNS Zones that have been removed are:<p><li>`{subzone}.privatelink.{regionName}.azmk8s.io`<li>`privatelink.{dnsPrefix}.database.windows.net`<li>`privatelink.{partitionId}.azurestaticapps.net`<p><p>We have also removed the following Private Link Private DNS Zones from the default value for this parameter as they should only be created and used with in specific scenarios:<p><li>`privatelink.azure.com`.<p>
Expand Down Expand Up @@ -341,6 +410,13 @@ An array of Private Link Private DNS Zones to create. Each item must be a valid
]
```

### Parameter: `tags`

Tags of the Private Link Private DNS Zones created.

- Required: No
- Type: object

### Parameter: `virtualNetworkResourceIdsToLinkTo`

An array of Virtual Network Resource IDs to link to the Private Link Private DNS Zones. Each item must be a valid Virtual Network Resource ID.
Expand All @@ -363,7 +439,7 @@ This section gives you an overview of all local-referenced module files (i.e., o

| Reference | Type |
| :-- | :-- |
| `br/public:avm/res/network/private-dns-zone:0.3.0` | Remote reference |
| `br/public:avm/res/network/private-dns-zone:0.6.0` | Remote reference |

## Data Collection

Expand Down
12 changes: 11 additions & 1 deletion avm/ptn/network/private-link-private-dns-zones/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ metadata owner = 'jtracey93'
@description('Optional. Azure region where the each of the Private Link Private DNS Zones created will be deployed, default to Resource Group location if not specified.')
param location string = resourceGroup().location

import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.2.1'
@description('Optional. The lock settings for the Private Link Private DNS Zones created.')
param lock lockType?

@description('Optional. Tags of the Private Link Private DNS Zones created.')
param tags object?

@description('''
Optional. An array of Private Link Private DNS Zones to create. Each item must be a valid DNS zone name.
Expand Down Expand Up @@ -287,7 +294,7 @@ resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableT
}
}

module pdnsZones 'br/public:avm/res/network/private-dns-zone:0.3.0' = [
module pdnsZones 'br/public:avm/res/network/private-dns-zone:0.6.0' = [
for zone in combinedPrivateLinkPrivateDnsZonesReplacedWithVnetsToLink: {
name: '${uniqueString(deployment().name, zone.pdnsZoneName, location)}-pdns-zone-deployment'
params: {
Expand All @@ -298,6 +305,9 @@ module pdnsZones 'br/public:avm/res/network/private-dns-zone:0.3.0' = [
virtualNetworkResourceId: vnet
}
]
lock: lock
tags: tags
enableTelemetry: enableTelemetry
}
}
]
Expand Down
Loading

0 comments on commit c5c2a03

Please sign in to comment.