forked from Azure/bicep-registry-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding Feature 2427 virtual hub routing intent (Azure#3040)
## Description <!-- >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. --> Adding support for configuring Routing Intent within a Virtual Hub. Due to limitations within the Virtual Hub API, if a pattern is enabling Routing Intent, the pattern _must_ create invoke this resource twice; the first invocation creates the Virtual Hub, then the second idempotent invocation updates the Virtual Hub with the Routing Intent configuration: 1. Invoke Virtual Hub resource (output hub resource ID) 2. Invoke Firewall resource (pass in hub resource ID) 3. Invoke Virtual Hub resource again (pass in Routing Intent configuration) Input parameters for the Routing Intent configuration are: _privateToFirewall bool internetToFirewall bool_ Closes [2427](Azure#2427) ## Pipeline Reference <!-- Insert your Pipeline Status Badge below --> [![avm.res.network.virtual-hub](https://github.com/ericscheffler/bicep-registry-modules/actions/workflows/avm.res.network.virtual-hub.yml/badge.svg?branch=Feature2427-VirtualHub_RoutingIntent)](https://github.com/ericscheffler/bicep-registry-modules/actions/workflows/avm.res.network.virtual-hub.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. - [ ] 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 ## 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 --> --------- Co-authored-by: erschef_microsoft <[email protected]> Co-authored-by: arnoldna <[email protected]>
- Loading branch information
1 parent
4a59f7c
commit 0451dba
Showing
12 changed files
with
686 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Virtual Hub Routing Intent `[Microsoft.Network/virtualHubs]` | ||
|
||
This module configures Routing Intent for a Virtual Hub; this module requires an existing Virtual Hub, as well the firewall Resource ID. | ||
|
||
## Navigation | ||
|
||
- [Resource Types](#Resource-Types) | ||
- [Parameters](#Parameters) | ||
- [Outputs](#Outputs) | ||
- [Cross-referenced modules](#Cross-referenced-modules) | ||
- [Notes](#Notes) | ||
- [Data Collection](#Data-Collection) | ||
|
||
## Resource Types | ||
|
||
| Resource Type | API Version | | ||
| :-- | :-- | | ||
| `Microsoft.Network/virtualHubs/routingIntent` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/virtualHubs/routingIntent) | | ||
|
||
## Parameters | ||
|
||
**Required parameters** | ||
|
||
| Parameter | Type | Description | | ||
| :-- | :-- | :-- | | ||
| [`azureFirewallResourceId`](#parameter-azurefirewallresourceid) | string | Hub firewall Resource ID. | | ||
| [`internetToFirewall`](#parameter-internettofirewall) | bool | Configures Routing Intent to Forward Internet traffic to the firewall (0.0.0.0/0). | | ||
| [`privateToFirewall`](#parameter-privatetofirewall) | bool | Configures Routing Intent to forward Private traffic to the firewall (RFC1918). | | ||
| [`virtualHubName`](#parameter-virtualhubname) | string | Name of the Virtual Hub. | | ||
|
||
### Parameter: `azureFirewallResourceId` | ||
|
||
Hub firewall Resource ID. | ||
|
||
- Required: Yes | ||
- Type: string | ||
|
||
### Parameter: `internetToFirewall` | ||
|
||
Configures Routing Intent to Forward Internet traffic to the firewall (0.0.0.0/0). | ||
|
||
- Required: Yes | ||
- Type: bool | ||
|
||
### Parameter: `privateToFirewall` | ||
|
||
Configures Routing Intent to forward Private traffic to the firewall (RFC1918). | ||
|
||
- Required: Yes | ||
- Type: bool | ||
|
||
### Parameter: `virtualHubName` | ||
|
||
Name of the Virtual Hub. | ||
|
||
- Required: Yes | ||
- Type: string | ||
|
||
|
||
## Outputs | ||
|
||
| Output | Type | Description | | ||
| :-- | :-- | :-- | | ||
| `name` | string | The name of the Routing Intent configuration. | | ||
| `resourceGroupName` | string | The resource group the Routing Intent configuration was deployed into. | | ||
| `resourceId` | string | The resource ID of the Routing Intent configuration. | | ||
|
||
## Cross-referenced modules | ||
|
||
_None_ | ||
|
||
## Notes | ||
|
||
The use of Routing Intent in a Virtual Hub requires the hub be made 'secure' by associating a firewall (to serve as the next-hop for the routing policy). | ||
|
||
The 'azureFirewall' parameter in Microsoft.Network/virtualHubs is *read-only*; in order to properly deploy a Virtual Hub using Routing Intent, the hub's Resource ID must first be passed to the firewall in order for it to be properly associated. In order for this resource to work properly, the resources need to be created in the following order: | ||
|
||
- **Virtual Hub**: Suggest minimal hub configuration; name/location/addressPrefix/virtualWan.id | ||
- **Firewall**: Including Virtual Hub Resource ID in the firewall configuration | ||
- **Virtual Hub**: Including all remaining parameters + Routing Intent | ||
|
||
## Data Collection | ||
|
||
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
metadata name = 'Virtual Hub Routing Intent' | ||
metadata description = 'This module configures Routing Intent for a Virtual Hub; this module requires an existing Virtual Hub, as well the firewall Resource ID.' | ||
metadata owner = 'Azure/module-maintainers' | ||
|
||
@description('Required. Hub firewall Resource ID.') | ||
param azureFirewallResourceId string | ||
|
||
@description('Required. Name of the Virtual Hub.') | ||
param virtualHubName string | ||
|
||
@description('Required. Configures Routing Intent to forward Private traffic to the firewall (RFC1918).') | ||
param privateToFirewall bool | ||
|
||
@description('Required. Configures Routing Intent to Forward Internet traffic to the firewall (0.0.0.0/0).') | ||
param internetToFirewall bool | ||
|
||
resource virtualHub 'Microsoft.Network/virtualHubs@2022-11-01' existing = { | ||
name: virtualHubName | ||
} | ||
|
||
resource routingIntent 'Microsoft.Network/virtualHubs/routingIntent@2023-11-01' = { | ||
name: 'defaultRouteTable' | ||
parent : virtualHub | ||
properties: { | ||
routingPolicies: (internetToFirewall == true && privateToFirewall == true) ? [ | ||
{ | ||
name: '_policy_PublicTraffic' | ||
destinations: [ | ||
'Internet' | ||
] | ||
nextHop: azureFirewallResourceId | ||
} | ||
{ | ||
name: '_policy_PrivateTraffic' | ||
destinations: [ | ||
'PrivateTraffic' | ||
] | ||
nextHop: azureFirewallResourceId | ||
} | ||
] : (internetToFirewall == true && privateToFirewall == false) ? [ | ||
{ | ||
name: '_policy_PublicTraffic' | ||
destinations: [ | ||
'Internet' | ||
] | ||
nextHop: azureFirewallResourceId | ||
} | ||
] : (internetToFirewall == false && privateToFirewall == true) ? [ | ||
{ | ||
name: '_policy_PrivateTraffic' | ||
destinations: [ | ||
'PrivateTraffic' | ||
] | ||
nextHop: azureFirewallResourceId | ||
} | ||
] | ||
: null | ||
} | ||
} | ||
|
||
@description('The name of the Routing Intent configuration.') | ||
output name string = routingIntent.name | ||
|
||
@description('The resource ID of the Routing Intent configuration.') | ||
output resourceId string = routingIntent.id | ||
|
||
@description('The resource group the Routing Intent configuration was deployed into.') | ||
output resourceGroupName string = resourceGroup().name |
Oops, something went wrong.