Skip to content

Commit

Permalink
hubNetwork: Dynamic prefix and suffix for Public IPs (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
picccard authored Apr 18, 2023
1 parent 1b72334 commit b958a61
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ parHubNetworkAddressPrefix | No | The IP address range for all virtual net
parSubnets | No | The name and IP address range for each subnet in the virtual networks.
parDnsServerIps | No | Array of DNS Server IP addresses for VNet.
parPublicIpSku | No | Public IP Address SKU.
parPublicIpPrefix | No | Optional Prefix for Public IPs. Include a succedent dash if required. Example: prefix-
parPublicIpSuffix | No | Optional Suffix for Public IPs. Include a preceding dash if required. Example: -suffix
parAzBastionEnabled | No | Switch to enable/disable Azure Bastion deployment. Default: true
parAzBastionName | No | Name Associated with Bastion Service.
parAzBastionSku | No | Azure Bastion SKU or Tier to deploy. Currently two options exist Basic and Standard.
Expand Down Expand Up @@ -94,6 +96,20 @@ Public IP Address SKU.

- Allowed values: `Basic`, `Standard`

### parPublicIpPrefix

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Optional Prefix for Public IPs. Include a succedent dash if required. Example: prefix-

### parPublicIpSuffix

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Optional Suffix for Public IPs. Include a preceding dash if required. Example: -suffix

- Default value: `-PublicIP`

### parAzBastionEnabled

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)
Expand Down Expand Up @@ -349,6 +365,12 @@ outHubVirtualNetworkId | string |
"parPublicIpSku": {
"value": "Standard"
},
"parPublicIpPrefix": {
"value": ""
},
"parPublicIpSuffix": {
"value": "-PublicIP"
},
"parAzBastionEnabled": {
"value": true
},
Expand Down
12 changes: 9 additions & 3 deletions infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ param parDnsServerIps array = []
])
param parPublicIpSku string = 'Standard'

@sys.description('Optional Prefix for Public IPs. Include a succedent dash if required. Example: prefix-')
param parPublicIpPrefix string = ''

@sys.description('Optional Suffix for Public IPs. Include a preceding dash if required. Example: -suffix')
param parPublicIpSuffix string = '-PublicIP'

@sys.description('Switch to enable/disable Azure Bastion deployment. Default: true')
param parAzBastionEnabled bool = true

Expand Down Expand Up @@ -295,7 +301,7 @@ module modBastionPublicIp '../publicIp/publicIp.bicep' = if (parAzBastionEnabled
name: 'deploy-Bastion-Public-IP'
params: {
parLocation: parLocation
parPublicIpName: '${parAzBastionName}-PublicIp'
parPublicIpName: '${parPublicIpPrefix}${parAzBastionName}${parPublicIpSuffix}'
parPublicIpSku: {
name: parPublicIpSku
}
Expand Down Expand Up @@ -500,7 +506,7 @@ module modGatewayPublicIp '../publicIp/publicIp.bicep' = [for (gateway, i) in va
params: {
parLocation: parLocation
parAvailabilityZones: gateway.gatewayType == 'ExpressRoute' ? parAzErGatewayAvailabilityZones : gateway.gatewayType == 'Vpn' ? parAzVpnGatewayAvailabilityZones : []
parPublicIpName: '${gateway.name}-PublicIp'
parPublicIpName: '${parPublicIpPrefix}${gateway.name}${parPublicIpSuffix}'
parPublicIpProperties: {
publicIpAddressVersion: 'IPv4'
publicIpAllocationMethod: 'Static'
Expand Down Expand Up @@ -558,7 +564,7 @@ module modAzureFirewallPublicIp '../publicIp/publicIp.bicep' = if (parAzFirewall
params: {
parLocation: parLocation
parAvailabilityZones: parAzFirewallAvailabilityZones
parPublicIpName: '${parAzFirewallName}-PublicIp'
parPublicIpName: '${parPublicIpPrefix}${parAzFirewallName}${parPublicIpSuffix}'
parPublicIpProperties: {
publicIpAddressVersion: 'IPv4'
publicIpAllocationMethod: 'Static'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
"parPublicIpSku": {
"value": "Standard"
},
"parPublicIpPrefix": {
"value": ""
},
"parPublicIpSuffix": {
"value": "-PublicIP"
},
"parAzBastionEnabled": {
"value": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
"parPublicIpSku": {
"value": "Standard"
},
"parPublicIpPrefix": {
"value": ""
},
"parPublicIpSuffix": {
"value": "-PublicIP"
},
"parAzBastionEnabled": {
"value": true
},
Expand Down

0 comments on commit b958a61

Please sign in to comment.