Skip to content

Commit

Permalink
feat: Add optional static route configuration for P2S VPN Gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
erschef committed Nov 25, 2024
1 parent e82865b commit 5381853
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 39 deletions.
38 changes: 36 additions & 2 deletions avm/res/network/p2s-vpn-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ module p2sVpnGateway 'br/public:avm/res/network/p2s-vpn-gateway:<version>' = {
Environment: 'Non-Prod'
Role: 'DeploymentValidation'
}
vnetRoutesStaticRoutes: {}
vpnClientAddressPoolAddressPrefixes: [
'10.0.2.0/24'
]
Expand Down Expand Up @@ -399,6 +400,9 @@ module p2sVpnGateway 'br/public:avm/res/network/p2s-vpn-gateway:<version>' = {
"Role": "DeploymentValidation"
}
},
"vnetRoutesStaticRoutes": {
"value": {}
},
"vpnClientAddressPoolAddressPrefixes": {
"value": [
"10.0.2.0/24"
Expand Down Expand Up @@ -432,6 +436,7 @@ param tags = {
Environment: 'Non-Prod'
Role: 'DeploymentValidation'
}
param vnetRoutesStaticRoutes = {}
param vpnClientAddressPoolAddressPrefixes = [
'10.0.2.0/24'
]
Expand Down Expand Up @@ -647,14 +652,43 @@ The routes from the virtual hub to virtual network connections.

The static route configuration for the P2S VPN Gateway.

- Required: Yes
- Required: No
- Type: array

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`addressPrefixes`](#parameter-vnetroutesstaticroutesstaticroutesaddressprefixes) | array | The address prefixes of the static route. |
| [`name`](#parameter-vnetroutesstaticroutesstaticroutesname) | string | The name of the static route. |
| [`nextHopIpAddress`](#parameter-vnetroutesstaticroutesstaticroutesnexthopipaddress) | string | The next hop IP of the static route. |

### Parameter: `vnetRoutesStaticRoutes.staticRoutes.addressPrefixes`

The address prefixes of the static route.

- Required: No
- Type: array

### Parameter: `vnetRoutesStaticRoutes.staticRoutes.name`

The name of the static route.

- Required: No
- Type: string

### Parameter: `vnetRoutesStaticRoutes.staticRoutes.nextHopIpAddress`

The next hop IP of the static route.

- Required: No
- Type: string

### Parameter: `vnetRoutesStaticRoutes.staticRoutesConfig`

The static route configuration for the P2S VPN Gateway.

- Required: Yes
- Required: No
- Type: object

**Optional parameters**
Expand Down
20 changes: 9 additions & 11 deletions avm/res/network/p2s-vpn-gateway/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,20 @@ type lockType = {
@description('Optional. A Type representing the VNET static routes for the P2S VPN Gateway.')
type vnetRoutesStaticRoutesType = {
@description('Optional. The static route configuration for the P2S VPN Gateway.')
staticRoutes: [
{
@description('Optional. The address prefixes of the static route.')
addressPrefixes: array?
staticRoutes: {
@description('Optional. The address prefixes of the static route.')
addressPrefixes: string[]?

@description('Optional. The name of the static route.')
name: string?
@description('Optional. The name of the static route.')
name: string?

@description('Optional. The next hop IP of the static route.')
nextHopIpAddress: string?
}
]
@description('Optional. The next hop IP of the static route.')
nextHopIpAddress: string?
}[]?
@description('Optional. The static route configuration for the P2S VPN Gateway.')
staticRoutesConfig: {
@description('Optional. Determines whether the NVA in a SPOKE VNET is bypassed for traffic with destination in spoke.')
vnetLocalRouteOverrideCriteria: string?
}
}?
}

54 changes: 28 additions & 26 deletions avm/res/network/p2s-vpn-gateway/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.31.92.45157",
"templateHash": "16702048568126491308"
"templateHash": "18201468322189687463"
},
"name": "P2S VPN Gateway",
"description": "This module deploys a Virtual Hub P2S Gateway.",
Expand Down Expand Up @@ -43,35 +43,36 @@
"properties": {
"staticRoutes": {
"type": "array",
"prefixItems": [
{
"type": "object",
"properties": {
"addressPrefixes": {
"type": "array",
"nullable": true,
"metadata": {
"description": "Optional. The address prefixes of the static route."
}
},
"name": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The name of the static route."
}
"items": {
"type": "object",
"properties": {
"addressPrefixes": {
"type": "array",
"items": {
"type": "string"
},
"nextHopIpAddress": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The next hop IP of the static route."
}
"nullable": true,
"metadata": {
"description": "Optional. The address prefixes of the static route."
}
},
"name": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The name of the static route."
}
},
"nextHopIpAddress": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The next hop IP of the static route."
}
}
}
],
"items": false,
},
"nullable": true,
"metadata": {
"description": "Optional. The static route configuration for the P2S VPN Gateway."
}
Expand All @@ -87,6 +88,7 @@
}
}
},
"nullable": true,
"metadata": {
"description": "Optional. The static route configuration for the P2S VPN Gateway."
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ module testDeployment '../../../main.bicep' = [
vpnClientAddressPoolAddressPrefixes: [
'10.0.2.0/24'
]
vnetRoutesStaticRoutes: {

}
virtualHubResourceId: nestedDependencies.outputs.virtualHubResourceId
vpnServerConfigurationResourceId: nestedDependencies.outputs.vpnServerConfigurationResourceId
}
Expand Down

0 comments on commit 5381853

Please sign in to comment.