зеркало из https://github.com/Azure/ALZ-Bicep.git
fix: General networking fixes and add active-active capability for vnet gateway (#863)
* Add condition for ddos output * Add capability for active-active vnet gateway * Update API versions
This commit is contained in:
Родитель
4cb81c7b1a
Коммит
2642d62619
|
@ -537,12 +537,12 @@ module modBastionPublicIp '../publicIp/publicIp.bicep' = if (parAzBastionEnabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource resBastionSubnetRef 'Microsoft.Network/virtualNetworks/subnets@2023-02-01' existing = if (parAzBastionEnabled) {
|
resource resBastionSubnetRef 'Microsoft.Network/virtualNetworks/subnets@2024-01-01' existing = if (parAzBastionEnabled) {
|
||||||
parent: resHubVnet
|
parent: resHubVnet
|
||||||
name: 'AzureBastionSubnet'
|
name: 'AzureBastionSubnet'
|
||||||
}
|
}
|
||||||
|
|
||||||
resource resBastionNsg 'Microsoft.Network/networkSecurityGroups@2023-02-01' = if (parAzBastionEnabled) {
|
resource resBastionNsg 'Microsoft.Network/networkSecurityGroups@2024-01-01' = if (parAzBastionEnabled) {
|
||||||
name: parAzBastionNsgName
|
name: parAzBastionNsgName
|
||||||
location: parLocation
|
location: parLocation
|
||||||
tags: parTags
|
tags: parTags
|
||||||
|
@ -704,7 +704,7 @@ resource resBastionNsgLock 'Microsoft.Authorization/locks@2020-05-01' = if (parA
|
||||||
// AzureBastionSubnet is required to deploy Bastion service. This subnet must exist in the parsubnets array if you enable Bastion Service.
|
// AzureBastionSubnet is required to deploy Bastion service. This subnet must exist in the parsubnets array if you enable Bastion Service.
|
||||||
// There is a minimum subnet requirement of /27 prefix.
|
// There is a minimum subnet requirement of /27 prefix.
|
||||||
// If you are deploying standard this needs to be larger. https://docs.microsoft.com/en-us/azure/bastion/configuration-settings#subnet
|
// If you are deploying standard this needs to be larger. https://docs.microsoft.com/en-us/azure/bastion/configuration-settings#subnet
|
||||||
resource resBastion 'Microsoft.Network/bastionHosts@2023-02-01' = if (parAzBastionEnabled) {
|
resource resBastion 'Microsoft.Network/bastionHosts@2024-01-01' = if (parAzBastionEnabled) {
|
||||||
location: parLocation
|
location: parLocation
|
||||||
name: parAzBastionName
|
name: parAzBastionName
|
||||||
tags: parTags
|
tags: parTags
|
||||||
|
@ -740,7 +740,7 @@ resource resBastionLock 'Microsoft.Authorization/locks@2020-05-01' = if (parAzBa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource resGatewaySubnetRef 'Microsoft.Network/virtualNetworks/subnets@2023-02-01' existing = if (parVpnGatewayEnabled || parExpressRouteGatewayEnabled ) {
|
resource resGatewaySubnetRef 'Microsoft.Network/virtualNetworks/subnets@2024-01-01' existing = if (parVpnGatewayEnabled || parExpressRouteGatewayEnabled ) {
|
||||||
parent: resHubVnet
|
parent: resHubVnet
|
||||||
name: 'GatewaySubnet'
|
name: 'GatewaySubnet'
|
||||||
}
|
}
|
||||||
|
@ -764,8 +764,28 @@ module modGatewayPublicIp '../publicIp/publicIp.bicep' = [for (gateway, i) in va
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
// If the gateway is active-active, create a second public IP
|
||||||
|
module modGatewayPublicIpActiveActive '../publicIp/publicIp.bicep' = [for (gateway, i) in varGwConfig: if ((gateway.name != 'noconfigVpn') && (gateway.name != 'noconfigEr') && gateway.activeActive) {
|
||||||
|
name: 'deploy-Gateway-Public-IP-ActiveActive-${i}'
|
||||||
|
params: {
|
||||||
|
parLocation: parLocation
|
||||||
|
parAvailabilityZones: toLower(gateway.gatewayType) == 'expressroute' ? parAzErGatewayAvailabilityZones : toLower(gateway.gatewayType) == 'vpn' ? parAzVpnGatewayAvailabilityZones : []
|
||||||
|
parPublicIpName: '${parPublicIpPrefix}${gateway.name}${parPublicIpSuffix}-aa'
|
||||||
|
parPublicIpProperties: {
|
||||||
|
publicIpAddressVersion: 'IPv4'
|
||||||
|
publicIpAllocationMethod: 'Static'
|
||||||
|
}
|
||||||
|
parPublicIpSku: {
|
||||||
|
name: parPublicIpSku
|
||||||
|
}
|
||||||
|
parResourceLockConfig: (parGlobalResourceLock.kind != 'None') ? parGlobalResourceLock : parVirtualNetworkGatewayLock
|
||||||
|
parTags: parTags
|
||||||
|
parTelemetryOptOut: parTelemetryOptOut
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
//Minumum subnet size is /27 supporting documentation https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-about-vpn-gateway-settings#gwsub
|
//Minumum subnet size is /27 supporting documentation https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-about-vpn-gateway-settings#gwsub
|
||||||
resource resGateway 'Microsoft.Network/virtualNetworkGateways@2023-02-01' = [for (gateway, i) in varGwConfig: if ((gateway.name != 'noconfigVpn') && (gateway.name != 'noconfigEr')) {
|
resource resGateway 'Microsoft.Network/virtualNetworkGateways@2024-01-01' = [for (gateway, i) in varGwConfig: if ((gateway.name != 'noconfigVpn') && (gateway.name != 'noconfigEr')) {
|
||||||
name: gateway.name
|
name: gateway.name
|
||||||
location: parLocation
|
location: parLocation
|
||||||
tags: parTags
|
tags: parTags
|
||||||
|
@ -793,23 +813,43 @@ resource resGateway 'Microsoft.Network/virtualNetworkGateways@2023-02-01' = [for
|
||||||
radiusServerAddress: gateway.vpnClientConfiguration.?radiusServerAddress ?? ''
|
radiusServerAddress: gateway.vpnClientConfiguration.?radiusServerAddress ?? ''
|
||||||
radiusServerSecret: gateway.vpnClientConfiguration.?radiusServerSecret ?? ''
|
radiusServerSecret: gateway.vpnClientConfiguration.?radiusServerSecret ?? ''
|
||||||
} : null
|
} : null
|
||||||
ipConfigurations: [
|
|
||||||
{
|
ipConfigurations: concat(
|
||||||
id: resHubVnet.id
|
// Primary IP configuration
|
||||||
name: 'vnetGatewayConfig'
|
[
|
||||||
properties: {
|
{
|
||||||
publicIPAddress: {
|
id: resHubVnet.id
|
||||||
id: (((gateway.name != 'noconfigVpn') && (gateway.name != 'noconfigEr')) ? modGatewayPublicIp[i].outputs.outPublicIpId : 'na')
|
name: 'vnetGatewayConfig1'
|
||||||
}
|
properties: {
|
||||||
subnet: {
|
publicIPAddress: {
|
||||||
id: resGatewaySubnetRef.id
|
id: modGatewayPublicIp[i].outputs.outPublicIpId // Primary Public IP
|
||||||
|
}
|
||||||
|
subnet: {
|
||||||
|
id: resGatewaySubnetRef.id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
]
|
// Add second IP configuration if activeActive is true
|
||||||
|
gateway.activeActive ? [
|
||||||
|
{
|
||||||
|
id: resHubVnet.id
|
||||||
|
name: 'vnetGatewayConfig2'
|
||||||
|
properties: {
|
||||||
|
publicIPAddress: {
|
||||||
|
id: modGatewayPublicIpActiveActive[i].outputs.outPublicIpId // Secondary Public IP
|
||||||
|
}
|
||||||
|
subnet: {
|
||||||
|
id: resGatewaySubnetRef.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] : []
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
||||||
// Create a Virtual Network Gateway resource lock if gateway.name is not equal to noconfigVpn or noconfigEr and parGlobalResourceLock.kind != 'None' or if parVirtualNetworkGatewayLock.kind != 'None'
|
// Create a Virtual Network Gateway resource lock if gateway.name is not equal to noconfigVpn or noconfigEr and parGlobalResourceLock.kind != 'None' or if parVirtualNetworkGatewayLock.kind != 'None'
|
||||||
resource resVirtualNetworkGatewayLock 'Microsoft.Authorization/locks@2020-05-01' = [for (gateway, i) in varGwConfig: if ((gateway.name != 'noconfigVpn') && (gateway.name != 'noconfigEr') && (parVirtualNetworkGatewayLock.kind != 'None' || parGlobalResourceLock.kind != 'None')) {
|
resource resVirtualNetworkGatewayLock 'Microsoft.Authorization/locks@2020-05-01' = [for (gateway, i) in varGwConfig: if ((gateway.name != 'noconfigVpn') && (gateway.name != 'noconfigEr') && (parVirtualNetworkGatewayLock.kind != 'None' || parGlobalResourceLock.kind != 'None')) {
|
||||||
scope: resGateway[i]
|
scope: resGateway[i]
|
||||||
|
@ -820,12 +860,12 @@ resource resVirtualNetworkGatewayLock 'Microsoft.Authorization/locks@2020-05-01'
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
resource resAzureFirewallSubnetRef 'Microsoft.Network/virtualNetworks/subnets@2023-02-01' existing = if (parAzFirewallEnabled) {
|
resource resAzureFirewallSubnetRef 'Microsoft.Network/virtualNetworks/subnets@2024-01-01' existing = if (parAzFirewallEnabled) {
|
||||||
parent: resHubVnet
|
parent: resHubVnet
|
||||||
name: 'AzureFirewallSubnet'
|
name: 'AzureFirewallSubnet'
|
||||||
}
|
}
|
||||||
|
|
||||||
resource resAzureFirewallMgmtSubnetRef 'Microsoft.Network/virtualNetworks/subnets@2023-02-01' existing = if (parAzFirewallEnabled && (contains(map(parSubnets, subnets => subnets.name), 'AzureFirewallManagementSubnet'))) {
|
resource resAzureFirewallMgmtSubnetRef 'Microsoft.Network/virtualNetworks/subnets@2024-01-01' existing = if (parAzFirewallEnabled && (contains(map(parSubnets, subnets => subnets.name), 'AzureFirewallManagementSubnet'))) {
|
||||||
parent: resHubVnet
|
parent: resHubVnet
|
||||||
name: 'AzureFirewallManagementSubnet'
|
name: 'AzureFirewallManagementSubnet'
|
||||||
}
|
}
|
||||||
|
@ -868,7 +908,7 @@ module modAzureFirewallMgmtPublicIp '../publicIp/publicIp.bicep' = if (parAzFire
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource resFirewallPolicies 'Microsoft.Network/firewallPolicies@2023-02-01' = if (parAzFirewallEnabled && parAzFirewallPoliciesEnabled) {
|
resource resFirewallPolicies 'Microsoft.Network/firewallPolicies@2024-01-01' = if (parAzFirewallEnabled && parAzFirewallPoliciesEnabled) {
|
||||||
name: parAzFirewallPoliciesName
|
name: parAzFirewallPoliciesName
|
||||||
location: parLocation
|
location: parLocation
|
||||||
tags: parTags
|
tags: parTags
|
||||||
|
@ -907,7 +947,7 @@ resource resFirewallPoliciesLock 'Microsoft.Authorization/locks@2020-05-01' = if
|
||||||
|
|
||||||
// AzureFirewallSubnet is required to deploy Azure Firewall . This subnet must exist in the parsubnets array if you deploy.
|
// AzureFirewallSubnet is required to deploy Azure Firewall . This subnet must exist in the parsubnets array if you deploy.
|
||||||
// There is a minimum subnet requirement of /26 prefix.
|
// There is a minimum subnet requirement of /26 prefix.
|
||||||
resource resAzureFirewall 'Microsoft.Network/azureFirewalls@2023-02-01' = if (parAzFirewallEnabled) {
|
resource resAzureFirewall 'Microsoft.Network/azureFirewalls@2024-01-01' = if (parAzFirewallEnabled) {
|
||||||
dependsOn: [
|
dependsOn: [
|
||||||
resGateway
|
resGateway
|
||||||
]
|
]
|
||||||
|
@ -1020,7 +1060,7 @@ resource resAzureFirewallLock 'Microsoft.Authorization/locks@2020-05-01' = if (p
|
||||||
}
|
}
|
||||||
|
|
||||||
//If Azure Firewall is enabled we will deploy a RouteTable to redirect Traffic to the Firewall.
|
//If Azure Firewall is enabled we will deploy a RouteTable to redirect Traffic to the Firewall.
|
||||||
resource resHubRouteTable 'Microsoft.Network/routeTables@2023-02-01' = if (parAzFirewallEnabled) {
|
resource resHubRouteTable 'Microsoft.Network/routeTables@2024-01-01' = if (parAzFirewallEnabled) {
|
||||||
name: parHubRouteTableName
|
name: parHubRouteTableName
|
||||||
location: parLocation
|
location: parLocation
|
||||||
tags: parTags
|
tags: parTags
|
||||||
|
|
|
@ -618,7 +618,7 @@ output outVirtualHubId array = [for (hub, i) in parVirtualWanHubs: {
|
||||||
}]
|
}]
|
||||||
|
|
||||||
// Output DDoS Plan ID
|
// Output DDoS Plan ID
|
||||||
output outDdosPlanResourceId string = resDdosProtectionPlan.id
|
output outDdosPlanResourceId string = parDdosEnabled ? resDdosProtectionPlan.id : ''
|
||||||
|
|
||||||
// Output Private DNS Zones
|
// Output Private DNS Zones
|
||||||
output outPrivateDnsZones array = (parPrivateDnsZonesEnabled ? modPrivateDnsZones.outputs.outPrivateDnsZones : [])
|
output outPrivateDnsZones array = (parPrivateDnsZonesEnabled ? modPrivateDnsZones.outputs.outPrivateDnsZones : [])
|
||||||
|
|
Загрузка…
Ссылка в новой задаче