Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added several user defined types, ability for custom resources names in vwanConnectivity and mgDiagSettings #656

Merged
merged 32 commits into from
Nov 20, 2023
Merged
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5b168e0
Added type virtualWanOptionsType, introduceded parUseCustomNamingSche…
johnlokerse Oct 13, 2023
0458900
Merge branch 'main' into issue/625
johnlokerse Oct 13, 2023
9ce72df
Check if parUseCustomNamingScheme is present in object
johnlokerse Oct 13, 2023
71501fa
Merge remote-tracking branch 'origin/issue/625' into issue/625
johnlokerse Oct 13, 2023
40b5d21
Merge branch 'main' into issue/625
johnlokerse Oct 13, 2023
d61d82a
Fixed parameter casing in baseline
johnlokerse Oct 13, 2023
11d9b08
Generate Parameter Markdowns [johnlokerse/40134377]
github-actions[bot] Oct 13, 2023
647e47b
Added parameters for resource names
johnlokerse Oct 13, 2023
1067b84
Merge remote-tracking branch 'origin/issue/625' into issue/625
johnlokerse Oct 13, 2023
ba1fd3d
Added subnetOptionsType
johnlokerse Oct 13, 2023
5bef430
Generate Parameter Markdowns [johnlokerse/40134377]
github-actions[bot] Oct 13, 2023
cf7cf41
Added descriptions
johnlokerse Oct 13, 2023
f3f5761
Added nonComplianceMessageType
johnlokerse Oct 13, 2023
48f6f3d
Added changes to parameter files, added diagnostic settings name to o…
johnlokerse Oct 16, 2023
91b68b1
Generate Parameter Markdowns [johnlokerse/40134377]
github-actions[bot] Oct 16, 2023
f3317e1
Merge branch 'main' into issue/625
johnlokerse Oct 17, 2023
2539d90
Merge branch 'main' into issue/625
johnlokerse Oct 19, 2023
534ea81
Merge branch 'main' into issue/625
johnlokerse Oct 25, 2023
b3895fb
Merge branch 'main' into issue/625
oZakari Oct 26, 2023
6870e7b
Merge branch 'main' into issue/625
johnlokerse Nov 1, 2023
859e7cb
Merge branch 'main' into issue/625
johnlokerse Nov 3, 2023
b99115f
Fix error for "List Azure Resources Types" because of usage of type
johnlokerse Nov 6, 2023
b92c651
Merge branch 'main' into issue/625
johnlokerse Nov 6, 2023
4edd4b8
Reduced complexity by using coalesce and safe-dereference operator
johnlokerse Nov 6, 2023
8df10a9
Merge branch 'main' into issue/625
johnlokerse Nov 10, 2023
3eb173b
Removed default value on description
johnlokerse Nov 10, 2023
d95225f
Generate Parameter Markdowns [johnlokerse/4e1ac12d]
github-actions[bot] Nov 10, 2023
016a826
Merge branch 'main' into issue/625
oZakari Nov 13, 2023
8d739de
Improve clarity for user defined type properties for the custom resou…
oZakari Nov 17, 2023
ef5590e
Merge branch 'main' into issue/625
oZakari Nov 17, 2023
38ba41d
Generate Parameter Markdowns [oZakari/ef8a90cc]
github-actions[bot] Nov 17, 2023
4a66214
Merge branch 'main' into issue/625
oZakari Nov 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 57 additions & 12 deletions infra-as-code/bicep/modules/vwanConnectivity/vwanConnectivity.bicep
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
metadata name = 'ALZ Bicep - Azure vWAN Connectivity Module'
metadata description = 'Module used to set up vWAN Connectivity'

type virtualWanOptionsType = ({
@sys.description('Switch to enable/disable VPN Gateway deployment on the respective Virtual WAN Hub.')
parVpnGatewayEnabled: bool

@sys.description('Switch to enable/disable ExpressRoute Gateway deployment on the respective Virtual WAN Hub.')
parExpressRouteGatewayEnabled: bool

@sys.description('Switch to enable/disable Azure Firewall deployment on the respective Virtual WAN Hub.')
parAzFirewallEnabled: bool

@sys.description('The IP address range in CIDR notation for the vWAN virtual Hub to use.')
parVirtualHubAddressPrefix: string

@sys.description('The Virtual WAN Hub location.')
parHubLocation: string

@sys.description('The Virtual WAN Hub routing preference. The allowed values are `ASN`, `VpnGateway`, `ExpressRoute`.')
parHubRoutingPreference: ('ExpressRoute' | 'VpnGateway' | 'ASN')

@sys.description('The Virtual WAN Hub capacity. The value should be between 2 to 50.')
@minValue(2)
@maxValue(50)
parVirtualRouterAutoScaleConfiguration: int

@sys.description('The Virtual WAN Hub routing intent destinations, leave empty if not wanting to enable routing intent. The allowed values are `Internet`, `PrivateTraffic`.')
parVirtualHubRoutingIntentDestinations: ('Internet' | 'PrivateTraffic')[]

@sys.description('Switch to enable/disable custom naming scheme. When enabled a custom name can be given for Azure Firewall, ExpressRoute Gateway, VPN Gateway and Virtual Hubs.')
parUseCustomNamingScheme: bool

@sys.description('When `parUseCustomNamingScheme` is true, this parameter is used to specify a custom name for the VPN Gateway.')
parVpnGatewayName: string?

@sys.description('When `parUseCustomNamingScheme` is true, this parameter is used to specify a custom name for the ExpressRoute Gateway.')
parExpressRouteGatewayName: string?

@sys.description('When `parUseCustomNamingScheme` is true, this parameter is used to specify a custom name for the Azure Firewall.')
parAzFirewallName: string?

@sys.description('When `parUseCustomNamingScheme` is true, this parameter is used to specify a custom name for the Virtual WAN Hub.')
parVirtualWanHubName: string?
})[]

@sys.description('Region in which the resource group was created.')
param parLocation string = resourceGroup().location

@sys.description('Prefix value which will be prepended to all resource names.')
param parCompanyPrefix string = 'alz'

@sys.description('Azure Firewall Tier associated with the Firewall to deploy.')
@sys.description('Azure Firewall Tier associated with the Firewall to deploy. If not set, the default value is Standard.')
oZakari marked this conversation as resolved.
Show resolved Hide resolved
@allowed([
'Basic'
'Standard'
Expand All @@ -29,7 +72,7 @@ param parVirtualHubEnabled bool = true
@sys.description('Switch to enable/disable Azure Firewall DNS Proxy.')
param parAzFirewallDnsProxyEnabled bool = true

@sys.description('Array of custom DNS servers used by Azure Firewall')
@sys.description('Array of custom DNS servers used by Azure Firewall.')
param parAzFirewallDnsServers array = []

@sys.description('Prefix Used for Virtual WAN.')
Expand All @@ -48,24 +91,26 @@ param parVirtualWanHubName string = '${parCompanyPrefix}-vhub'
- `parHubRoutingPreference` - The Virtual WAN Hub routing preference. The allowed values are `ASN`, `VpnGateway`, `ExpressRoute`.
- `parVirtualRouterAutoScaleConfiguration` - The Virtual WAN Hub capacity. The value should be between 2 to 50.
- `parVirtualHubRoutingIntentDestinations` - The Virtual WAN Hub routing intent destinations, leave empty if not wanting to enable routing intent. The allowed values are `Internet`, `PrivateTraffic`.
- `parUseCustomNamingScheme` - Switch to enable/disable custom naming scheme. When enabled a custom name can be given for Azure Firewall, ExpressRoute Gateway, VPN Gateway and Virtual Hubs.

''')
param parVirtualWanHubs array = [ {
param parVirtualWanHubs virtualWanOptionsType = [ {
parVpnGatewayEnabled: true
parExpressRouteGatewayEnabled: true
parAzFirewallEnabled: true
parVirtualHubAddressPrefix: '10.100.0.0/23'
parHubLocation: parLocation
parHubRoutingPreference: 'ExpressRoute' //allowed values are 'ASN','VpnGateway','ExpressRoute'.
parVirtualRouterAutoScaleConfiguration: 2 //minimum capacity should be between 2 to 50
parHubRoutingPreference: 'ExpressRoute'
parVirtualRouterAutoScaleConfiguration: 2
parVirtualHubRoutingIntentDestinations: []
parUseCustomNamingScheme: false
}
]

@sys.description('Prefix Used for VPN Gateway.')
@sys.description('VPN Gateway Name.')
oZakari marked this conversation as resolved.
Show resolved Hide resolved
param parVpnGatewayName string = '${parCompanyPrefix}-vpngw'

@sys.description('Prefix Used for ExpressRoute Gateway.')
@sys.description('ExpressRoute Gateway Name.')
oZakari marked this conversation as resolved.
Show resolved Hide resolved
param parExpressRouteGatewayName string = '${parCompanyPrefix}-ergw'

@sys.description('Azure Firewall Name.')
Expand Down Expand Up @@ -210,7 +255,7 @@ resource resVwan 'Microsoft.Network/virtualWans@2023-04-01' = {
}

resource resVhub 'Microsoft.Network/virtualHubs@2023-04-01' = [for hub in parVirtualWanHubs: if (parVirtualHubEnabled && !empty(hub.parVirtualHubAddressPrefix)) {
name: '${parVirtualWanHubName}-${hub.parHubLocation}'
name: hub.parUseCustomNamingScheme ? hub.parVirtualWanHubName! : '${parVirtualWanHubName}-${hub.parHubLocation}'!
location: hub.parHubLocation
tags: parTags
properties: {
Expand Down Expand Up @@ -249,7 +294,7 @@ resource resVhubRouteTable 'Microsoft.Network/virtualHubs/hubRouteTables@2023-04

resource resVhubRoutingIntent 'Microsoft.Network/virtualHubs/routingIntent@2023-04-01' = [for (hub, i) in parVirtualWanHubs: if (parVirtualHubEnabled && hub.parAzFirewallEnabled && !empty(hub.parVirtualHubRoutingIntentDestinations)) {
parent: resVhub[i]
name: '${parVirtualWanHubName}-${hub.parHubLocation}-Routing-Intent'
name: hub.parUseCustomNamingScheme ? '${parVirtualWanHubName}-Routing-Intent' : '${parVirtualWanHubName}-${hub.parHubLocation}-Routing-Intent'
properties: {
routingPolicies: [for destination in hub.parVirtualHubRoutingIntentDestinations: {
name: destination == 'Internet' ? 'PublicTraffic' : destination == 'PrivateTraffic' ? 'PrivateTraffic' : 'N/A'
Expand All @@ -263,7 +308,7 @@ resource resVhubRoutingIntent 'Microsoft.Network/virtualHubs/routingIntent@2023-

resource resVpnGateway 'Microsoft.Network/vpnGateways@2023-02-01' = [for (hub, i) in parVirtualWanHubs: if ((parVirtualHubEnabled) && (hub.parVpnGatewayEnabled)) {
dependsOn: resVhub
name: '${parVpnGatewayName}-${hub.parHubLocation}'
name: hub.parUseCustomNamingScheme ? hub.parVpnGatewayName! : '${parVpnGatewayName}-${hub.parHubLocation}'
location: hub.parHubLocation
tags: parTags
properties: {
Expand All @@ -281,7 +326,7 @@ resource resVpnGateway 'Microsoft.Network/vpnGateways@2023-02-01' = [for (hub, i

resource resErGateway 'Microsoft.Network/expressRouteGateways@2023-02-01' = [for (hub, i) in parVirtualWanHubs: if ((parVirtualHubEnabled) && (hub.parExpressRouteGatewayEnabled)) {
dependsOn: resVhub
name: '${parExpressRouteGatewayName}-${hub.parHubLocation}'
name: hub.parUseCustomNamingScheme ? hub.parExpressRouteGatewayName! : '${parExpressRouteGatewayName}-${hub.parHubLocation}'
location: hub.parHubLocation
tags: parTags
properties: {
Expand Down Expand Up @@ -318,7 +363,7 @@ resource resFirewallPolicies 'Microsoft.Network/firewallPolicies@2023-02-01' = i
}

resource resAzureFirewall 'Microsoft.Network/azureFirewalls@2023-02-01' = [for (hub, i) in parVirtualWanHubs: if ((parVirtualHubEnabled) && (hub.parAzFirewallEnabled)) {
name: '${parAzFirewallName}-${hub.parHubLocation}'
name: hub.parUseCustomNamingScheme ? hub.parAzFirewallName! : '${parAzFirewallName}-${hub.parHubLocation}'
location: hub.parHubLocation
tags: parTags
zones: (!empty(parAzFirewallAvailabilityZones) ? parAzFirewallAvailabilityZones : null)
Expand Down
Loading