Skip to content

Commit

Permalink
feat: Updated Network Manager module to support Routing Configuration…
Browse files Browse the repository at this point in the history
… feature (#4096)

## Description

Azure Virtual Network Manager (AVNM) recently introduced a new feature
that allows users to configure routing settings for their virtual
networks. See
[concept-user-defined-route](https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-user-defined-route)
documentation.

ℹ️ Routing Configuration is Generally Available in many Azure regions:
See [UDR Management - General
Availability](https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-user-defined-route#general-availability).
Given the optional usage of this feature, This should not impact
existing usage of AVNM.

While enabling this feature, the following had to be updated on the
module:
- Added new child modules for `routing-configuration`, `rule-collection`
and `rule`.
- Updated the API to `2024-05-01` as per
(https://learn.microsoft.com/en-us/azure/templates/microsoft.network/networkmanagers?pivots=deployment-language-bicep)
- Updated module version.
- Use of the common types for `roleAssignments` and `locks`.
- Update the scope access to become optional as AVNM now enables a
`None` feature mode to support capabilities like IPAM and Virtual
Network Verifier.
- Updated built in role name from `IPAM Pool Contributor` to `IPAM Pool
User`, Still keeps the same GUID.
- Added support for `memberType` for Subnets for Network Groups to
support the new routing feature. However, set the default to virtual
network as it is the common scenario.
- Updated the default test case to not use any features.
- Expanded on the max test case coverage to include the routing feature
and added different network groups of subnet types.
- Expanded on usage of the `import` functionality to reduce code
duplication and import types from child module to parents.

<!--
>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 #123
Fixes #456
Closes #123
Closes #456
-->

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.network.network-manager](https://github.com/ahmadabdalla/bicep-registry-modules/actions/workflows/avm.res.network.network-manager.yml/badge.svg?branch=users%2Fahmad%2FNM_Routing)](https://github.com/ahmadabdalla/bicep-registry-modules/actions/workflows/avm.res.network.network-manager.yml)
|

## Type of Change

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

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [ ] 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
ahmadabdalla authored Jan 9, 2025
1 parent 44836fd commit 5ed0e20
Show file tree
Hide file tree
Showing 37 changed files with 6,300 additions and 2,234 deletions.
582 changes: 517 additions & 65 deletions avm/res/network/network-manager/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Connectivity configurations define hub-and-spoke or mesh topologies applied to o

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Network/networkManagers/connectivityConfigurations` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/networkManagers/connectivityConfigurations) |
| `Microsoft.Network/networkManagers/connectivityConfigurations` | [2024-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2024-05-01/networkManagers/connectivityConfigurations) |

## Parameters

Expand Down Expand Up @@ -172,6 +172,7 @@ A description of the connectivity configuration.

- Required: No
- Type: string
- Default: `''`

### Parameter: `isGlobal`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param name string

@maxLength(500)
@sys.description('Optional. A description of the connectivity configuration.')
param description string?
param description string = ''

@sys.description('Required. Network Groups for the configuration. A connectivity configuration must be associated to at least one network group.')
param appliesToGroups appliesToGroupsType
Expand All @@ -33,11 +33,11 @@ param deleteExistingPeering bool = false
@sys.description('Optional. Flag if global mesh is supported. By default, mesh connectivity is applied to virtual networks within the same region. If set to "True", a global mesh enables connectivity across regions.')
param isGlobal bool = false

resource networkManager 'Microsoft.Network/networkManagers@2023-11-01' existing = {
resource networkManager 'Microsoft.Network/networkManagers@2024-05-01' existing = {
name: networkManagerName
}

resource connectivityConfiguration 'Microsoft.Network/networkManagers/connectivityConfigurations@2023-11-01' = {
resource connectivityConfiguration 'Microsoft.Network/networkManagers/connectivityConfigurations@2024-05-01' = {
name: name
parent: networkManager
properties: {
Expand All @@ -49,7 +49,7 @@ resource connectivityConfiguration 'Microsoft.Network/networkManagers/connectivi
})
connectivityTopology: connectivityTopology
deleteExistingPeering: connectivityTopology == 'HubAndSpoke' ? string(deleteExistingPeering) : 'false'
description: description ?? ''
description: description
hubs: connectivityTopology == 'HubAndSpoke' ? hubs : []
isGlobal: string(isGlobal)
}
Expand All @@ -68,6 +68,7 @@ output resourceGroupName string = resourceGroup().name
// Definitions //
// =============== //

@export()
type appliesToGroupsType = {
@sys.description('Required. Group connectivity type.')
groupConnectivity: ('DirectlyConnected' | 'None')
Expand All @@ -82,6 +83,7 @@ type appliesToGroupsType = {
useHubGateway: bool?
}[]

@export()
type hubsType = {
@sys.description('Required. Resource Id of the hub.')
resourceId: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "9454472323100733583"
"templateHash": "16461686527041815345"
},
"name": "Network Manager Connectivity Configurations",
"description": "This module deploys a Network Manager Connectivity Configuration.\nConnectivity configurations define hub-and-spoke or mesh topologies applied to one or more network groups.",
"description": "This module deploys a Network Manager Connectivity Configuration.\r\nConnectivity configurations define hub-and-spoke or mesh topologies applied to one or more network groups.",
"owner": "Azure/module-maintainers"
},
"definitions": {
Expand Down Expand Up @@ -49,6 +49,9 @@
}
}
}
},
"metadata": {
"__bicep_export!": true
}
},
"hubsType": {
Expand All @@ -73,7 +76,10 @@
}
}
},
"nullable": true
"nullable": true,
"metadata": {
"__bicep_export!": true
}
}
},
"parameters": {
Expand All @@ -92,7 +98,7 @@
},
"description": {
"type": "string",
"nullable": true,
"defaultValue": "",
"maxLength": 500,
"metadata": {
"description": "Optional. A description of the connectivity configuration."
Expand Down Expand Up @@ -139,18 +145,18 @@
"networkManager": {
"existing": true,
"type": "Microsoft.Network/networkManagers",
"apiVersion": "2023-11-01",
"apiVersion": "2024-05-01",
"name": "[parameters('networkManagerName')]"
},
"connectivityConfiguration": {
"type": "Microsoft.Network/networkManagers/connectivityConfigurations",
"apiVersion": "2023-11-01",
"apiVersion": "2024-05-01",
"name": "[format('{0}/{1}', parameters('networkManagerName'), parameters('name'))]",
"properties": {
"appliesToGroups": "[map(parameters('appliesToGroups'), lambda('group', createObject('groupConnectivity', lambdaVariables('group').groupConnectivity, 'isGlobal', coalesce(string(lambdaVariables('group').isGlobal), 'false'), 'networkGroupId', lambdaVariables('group').networkGroupResourceId, 'useHubGateway', coalesce(string(lambdaVariables('group').useHubGateway), 'false'))))]",
"connectivityTopology": "[parameters('connectivityTopology')]",
"deleteExistingPeering": "[if(equals(parameters('connectivityTopology'), 'HubAndSpoke'), string(parameters('deleteExistingPeering')), 'false')]",
"description": "[coalesce(parameters('description'), '')]",
"description": "[parameters('description')]",
"hubs": "[if(equals(parameters('connectivityTopology'), 'HubAndSpoke'), parameters('hubs'), createArray())]",
"isGlobal": "[string(parameters('isGlobal'))]"
}
Expand Down
Loading

0 comments on commit 5ed0e20

Please sign in to comment.