Skip to content

Commit

Permalink
feat: Add availability zones to avm/res/network/public-ip-prefix (A…
Browse files Browse the repository at this point in the history
…zure#1500)

## Description

Adds `zones` parameter to the module.

Resolves Azure#1487 

<!--
>Thank you for your contribution !
> Please include a summary of the change and which issue is fixed.
> Please also include the context.
> List any dependencies that are required for this change.

Fixes Azure#123
Fixes Azure#456
Closes Azure#123
Closes Azure#456
-->

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.res.network.public-ip-prefix](https://github.com/krbar/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-prefix.yml/badge.svg?branch=users%2Fkrbar%2FpippfxZones)](https://github.com/krbar/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-prefix.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:
- [ ] 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 day with the contribution guide at
https://aka.ms/avm/contribute/bicep -->

---------

Co-authored-by: Alexander Sehr <[email protected]>
  • Loading branch information
2 people authored and segraef committed Apr 4, 2024
1 parent a20ae69 commit eb6fbe4
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 2 deletions.
34 changes: 34 additions & 0 deletions avm/res/network/public-ip-prefix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ module publicIpPrefix 'br/public:avm/res/network/public-ip-prefix:<version>' = {
'hidden-title': 'This is visible in the resource name'
Role: 'DeploymentValidation'
}
zones: [
1
2
]
}
}
```
Expand Down Expand Up @@ -185,6 +189,12 @@ module publicIpPrefix 'br/public:avm/res/network/public-ip-prefix:<version>' = {
"hidden-title": "This is visible in the resource name",
"Role": "DeploymentValidation"
}
},
"zones": {
"value": [
1,
2
]
}
}
}
Expand Down Expand Up @@ -277,6 +287,7 @@ module publicIpPrefix 'br/public:avm/res/network/public-ip-prefix:<version>' = {
| [`lock`](#parameter-lock) | object | The lock settings of the service. |
| [`roleAssignments`](#parameter-roleassignments) | array | Array of role assignments to create. |
| [`tags`](#parameter-tags) | object | Tags of the resource. |
| [`zones`](#parameter-zones) | array | A list of availability zones denoting the IP allocated for the resource needs to come from. |

### Parameter: `name`

Expand Down Expand Up @@ -448,6 +459,29 @@ Tags of the resource.
- Required: No
- Type: object

### Parameter: `zones`

A list of availability zones denoting the IP allocated for the resource needs to come from.

- Required: No
- Type: array
- Default:
```Bicep
[
1
2
3
]
```
- Allowed:
```Bicep
[
1
2
3
]
```


## Outputs

Expand Down
13 changes: 13 additions & 0 deletions avm/res/network/public-ip-prefix/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ param tags object?
@description('Optional. The custom IP address prefix that this prefix is associated with. A custom IP address prefix is a contiguous range of IP addresses owned by an external customer and provisioned into a subscription. When a custom IP prefix is in Provisioned, Commissioning, or Commissioned state, a linked public IP prefix can be created. Either as a subset of the custom IP prefix range or the entire range.')
param customIPPrefix object = {}

@description('Optional. A list of availability zones denoting the IP allocated for the resource needs to come from.')
@allowed([
1
2
3
])
param zones int[] = [
1
2
3
]

@description('Optional. Enable/Disable usage telemetry for module.')
param enableTelemetry bool = true

Expand Down Expand Up @@ -73,6 +85,7 @@ resource publicIpPrefix 'Microsoft.Network/publicIPPrefixes@2023-09-01' = {
sku: {
name: 'Standard'
}
zones: map(zones, zone => string(zone))
properties: {
customIPPrefix: !empty(customIPPrefix) ? customIPPrefix : null
publicIPAddressVersion: 'IPv4'
Expand Down
22 changes: 21 additions & 1 deletion avm/res/network/public-ip-prefix/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "7016457133056549138"
"templateHash": "11461243147494849566"
},
"name": "Public IP Prefixes",
"description": "This module deploys a Public IP Prefix.",
Expand Down Expand Up @@ -154,6 +154,25 @@
"description": "Optional. The custom IP address prefix that this prefix is associated with. A custom IP address prefix is a contiguous range of IP addresses owned by an external customer and provisioned into a subscription. When a custom IP prefix is in Provisioned, Commissioning, or Commissioned state, a linked public IP prefix can be created. Either as a subset of the custom IP prefix range or the entire range."
}
},
"zones": {
"type": "array",
"items": {
"type": "int"
},
"defaultValue": [
1,
2,
3
],
"allowedValues": [
1,
2,
3
],
"metadata": {
"description": "Optional. A list of availability zones denoting the IP allocated for the resource needs to come from."
}
},
"enableTelemetry": {
"type": "bool",
"defaultValue": true,
Expand Down Expand Up @@ -202,6 +221,7 @@
"sku": {
"name": "Standard"
},
"zones": "[map(parameters('zones'), lambda('zone', string(lambdaVariables('zone'))))]",
"properties": {
"customIPPrefix": "[if(not(empty(parameters('customIPPrefix'))), parameters('customIPPrefix'), null())]",
"publicIPAddressVersion": "IPv4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ module testDeployment '../../../main.bicep' = [
Environment: 'Non-Prod'
Role: 'DeploymentValidation'
}
zones: [
1
2
]
}
}
]
2 changes: 1 addition & 1 deletion avm/res/network/public-ip-prefix/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.2",
"version": "0.3",
"pathFilters": [
"./main.json"
]
Expand Down

0 comments on commit eb6fbe4

Please sign in to comment.