Skip to content

Commit

Permalink
Description updates, consistency usage of camelCasing (vnetPeering) (#…
Browse files Browse the repository at this point in the history
…232)

* Some description and camelCase changes

* camelCasing parDestinationVirtualNetworkId

* camelCasing parDestinationVirtualNetworkId

* Fix linting issues

* Update: destination vnet id casing for unit tests
  • Loading branch information
johnlokerse authored May 13, 2022
1 parent b3f675e commit 4c6254b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion infra-as-code/bicep/modules/vnetPeering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The module requires the following inputs:

| Parameter | Type | Default | Description | Requirement | Example |
| -------------------------------- | ------ | ------- | --------------------------------------------------------------- | -------------------------------------------- | --------------- |
| parDestinationVirtualNetworkID | string | None | ID of the Destination Virtual Network | Valid Virtual Network ID |
| parDestinationVirtualNetworkId | string | None | ID of the Destination Virtual Network | Valid Virtual Network ID |
| parSourceVirtualNetworkName | string | None | Name of Source Virtual Network | Valid Azure Region | alz-spk-eastus2 |
| parDestinationVirtualNetworkName | string | None | Virtual Network Name of the destination/target Virtual Network. | 2-64 char, letters, numbers, and underscores | alz-hub-eastus2 |
| parAllowVirtualNetworkAccess | bool | true | Switch to enable virtual Network Access | None | true |
Expand Down
18 changes: 9 additions & 9 deletions infra-as-code/bicep/modules/vnetPeering/vnetPeering.bicep
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
@description('Virtual Network ID of Virtual Network destination. No default')
param parDestinationVirtualNetworkID string
param parDestinationVirtualNetworkId string

@description('Name of source Virtual Network we are peering. No default')
param parSourceVirtualNetworkName string

@description('Name of destination virtual network we are peering. No Default')
@description('Name of destination virtual network we are peering. No default')
param parDestinationVirtualNetworkName string

@description('Switch to enable/disable Virtual Network Access for the Network Peer. Default = true')
param parAllowVirtualNetworkAccess bool = true

@description('Switch to enable/disable forwarded Traffic for the Network Peer. Default = true')
@description('Switch to enable/disable forwarded traffic for the Network Peer. Default = true')
param parAllowForwardedTraffic bool = true

@description('Switch to enable/disable forwarded Traffic for the Network Peer. Default = false')
@description('Switch to enable/disable gateway transit for the Network Peer. Default = false')
param parAllowGatewayTransit bool = false

@description('Switch to enable/disable remote Gateway for the Network Peer. Default = false')
@description('Switch to enable/disable remote gateway for the Network Peer. Default = false')
param parUseRemoteGateways bool = false

@description('Set Parameter to true to Opt-out of deployment telemetry')
@description('Set Parameter to true to Opt-out of deployment telemetry. Default = false')
param parTelemetryOptOut bool = false

// Customer Usage Attribution Id
var varCuaid = 'ab8e3b12-b0fa-40aa-8630-e3f7699e2142'
var varCuaId = 'ab8e3b12-b0fa-40aa-8630-e3f7699e2142'

resource resVirtualNetworkPeer 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-11-01' = {
name: '${parSourceVirtualNetworkName}/peer-to-${parDestinationVirtualNetworkName}'
Expand All @@ -33,14 +33,14 @@ resource resVirtualNetworkPeer 'Microsoft.Network/virtualNetworks/virtualNetwork
allowGatewayTransit: parAllowGatewayTransit
useRemoteGateways: parUseRemoteGateways
remoteVirtualNetwork: {
id: parDestinationVirtualNetworkID
id: parDestinationVirtualNetworkId
}
}
}

// Optional Deployment for Customer Usage Attribution
module modCustomerUsageAttribution '../../CRML/customerUsageAttribution/cuaIdResourceGroup.bicep' = if (!parTelemetryOptOut) {
#disable-next-line no-loc-expr-outside-params //Only to ensure telemetry data is stored in same location as deployment. See https://github.com/Azure/ALZ-Bicep/wiki/FAQ#why-are-some-linter-rules-disabled-via-the-disable-next-line-bicep-function for more information
name: 'pid-${varCuaid}-${uniqueString(resourceGroup().location)}'
name: 'pid-${varCuaId}-${uniqueString(resourceGroup().location)}'
params: {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"parDestinationVirtualNetworkID": {
"parDestinationVirtualNetworkId": {
"value": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/HUB_Networking_POC/providers/Microsoft.Network/virtualNetworks/alz-hub-eastus"
},
"parSourceVirtualNetworkName": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ module modHubPeeringToSpoke '../../modules/vnetPeering/vnetPeering.bicep' = if (
scope: resourceGroup(varHubVirtualNetworkSubscriptionId,varHubVirtualNetworkResourceGroup)
name: varModuleDeploymentNames.modSpokePeeringFromHub
params: {
parDestinationVirtualNetworkID: (!empty(varHubVirtualNetworkName) ? modSpokeNetworking.outputs.outSpokeVirtualNetworkId : '')
parDestinationVirtualNetworkId: (!empty(varHubVirtualNetworkName) ? modSpokeNetworking.outputs.outSpokeVirtualNetworkId : '')
parDestinationVirtualNetworkName: (!empty(varHubVirtualNetworkName) ? modSpokeNetworking.outputs.outSpokeVirtualNetworkName : '')
parSourceVirtualNetworkName: varHubVirtualNetworkName
parAllowForwardedTraffic: parAllowSpokeForwardedTraffic
Expand All @@ -167,7 +167,7 @@ module modSpokePeeringToHub '../../modules/vnetPeering/vnetPeering.bicep' = if (
scope: resourceGroup(parPeeredVnetSubscriptionId,parResourceGroupNameForSpokeNetworking)
name: varModuleDeploymentNames.modSpokePeeringToHub
params: {
parDestinationVirtualNetworkID: parHubVirtualNetworkId
parDestinationVirtualNetworkId: parHubVirtualNetworkId
parDestinationVirtualNetworkName: varHubVirtualNetworkName
parSourceVirtualNetworkName: (!empty(varHubVirtualNetworkName) ? modSpokeNetworking.outputs.outSpokeVirtualNetworkName : '')
parUseRemoteGateways: parAllowHubVpnGatewayTransit
Expand Down
4 changes: 2 additions & 2 deletions tests/pipelines/bicep-build-to-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ jobs:
inputs:
targetType: 'inline'
script: |
az deployment group create --resource-group $(ResourceGroupName) --template-file infra-as-code/bicep/modules/vnetPeering/vnetPeering.bicep --parameters @infra-as-code/bicep/modules/vnetPeering/vnetPeering.parameters.example.json parDestinationVirtualNetworkID="/subscriptions/$(subscriptionId)/resourceGroups/$(ResourceGroupName)/providers/Microsoft.Network/virtualNetworks/alz-hub-eastus"
az deployment group create --resource-group $(ResourceGroupName) --template-file infra-as-code/bicep/modules/vnetPeering/vnetPeering.bicep --parameters @infra-as-code/bicep/modules/vnetPeering/vnetPeering.parameters.example.json parDestinationVirtualNetworkId="/subscriptions/$(subscriptionId)/resourceGroups/$(ResourceGroupName)/providers/Microsoft.Network/virtualNetworks/alz-hub-eastus"
- task: Bash@3
displayName: Az CLI Deploy vNet Peer for PR hub to spoke
Expand All @@ -243,7 +243,7 @@ jobs:
inputs:
targetType: 'inline'
script: |
az deployment group create --resource-group $(ResourceGroupName) --template-file infra-as-code/bicep/modules/vnetPeering/vnetPeering.bicep --parameters @infra-as-code/bicep/modules/vnetPeering/vnetPeering.parameters.example.json parDestinationVirtualNetworkID="/subscriptions/$(subscriptionId)/resourceGroups/$(ResourceGroupName)/providers/Microsoft.Network/virtualNetworks/vnet-spoke" parSourceVirtualNetworkName="alz-hub-eastus" parDestinationVirtualNetworkName="vnet-spoke"
az deployment group create --resource-group $(ResourceGroupName) --template-file infra-as-code/bicep/modules/vnetPeering/vnetPeering.bicep --parameters @infra-as-code/bicep/modules/vnetPeering/vnetPeering.parameters.example.json parDestinationVirtualNetworkId="/subscriptions/$(subscriptionId)/resourceGroups/$(ResourceGroupName)/providers/Microsoft.Network/virtualNetworks/vnet-spoke" parSourceVirtualNetworkName="alz-hub-eastus" parDestinationVirtualNetworkName="vnet-spoke"
- job: bicep_cleanup
dependsOn: bicep_deploy
Expand Down

0 comments on commit 4c6254b

Please sign in to comment.