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

Fix deployment double loop in #519 #520

Merged
merged 3 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
Parameter name | Required | Description
-------------- | -------- | -----------
parSpokeVirtualNetworkResourceId | No | The Spoke Virtual Network Resource ID.
parPrivateDnsZoneResourceIds | No | The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.
parPrivateDnsZoneResourceId | No | The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.

### parSpokeVirtualNetworkResourceId

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

The Spoke Virtual Network Resource ID.

### parPrivateDnsZoneResourceIds
### parPrivateDnsZoneResourceId

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

Expand All @@ -34,8 +34,8 @@ The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.
"parSpokeVirtualNetworkResourceId": {
"value": ""
},
"parPrivateDnsZoneResourceIds": {
"value": []
"parPrivateDnsZoneResourceId": {
"value": ""
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ targetScope = 'resourceGroup'
param parSpokeVirtualNetworkResourceId string = ''

@sys.description('The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.')
param parPrivateDnsZoneResourceIds array = []
param parPrivateDnsZoneResourceId string = ''

var varSpokeVirtualNetworkName = split(parSpokeVirtualNetworkResourceId, '/')[8]

resource resPrivateDnsZoneLinkToSpoke 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2020-06-01' = [for zones in parPrivateDnsZoneResourceIds: if (!empty(parPrivateDnsZoneResourceIds)) {
resource resPrivateDnsZoneLinkToSpoke 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2020-06-01' = if (!empty(parPrivateDnsZoneResourceId)) {
location: 'global'
name: '${split(zones, '/')[8]}/dnslink-to-${varSpokeVirtualNetworkName}'
name: '${split(parPrivateDnsZoneResourceId, '/')[8]}/dnslink-to-${varSpokeVirtualNetworkName}'
properties: {
registrationEnabled: false
virtualNetwork: {
id: parSpokeVirtualNetworkResourceId
}
}
}]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ targetScope = 'resourceGroup'
param parSpokeVirtualNetworkResourceId string = '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/<RG-NAME>/providers/Microsoft.Network/virtualNetworks/<VNET-NAME>'

@sys.description('The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.')
param parPrivateDnsZoneResourceIds array = []
param parPrivateDnsZoneResourceId string = '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/<RG-NAME>/providers/Microsoft.Network/privateDnsZones/<ZONE-NAME>'

// ---------
// RESOURCES
Expand All @@ -24,7 +24,7 @@ param parPrivateDnsZoneResourceIds array = []
module baseline_private_dns_zone_linking '../privateDnsZoneLinks.bicep' = {
name: 'baseline_vnet_peering'
params: {
parPrivateDnsZoneResourceIds: parPrivateDnsZoneResourceIds
parPrivateDnsZoneResourceId: parPrivateDnsZoneResourceId
parSpokeVirtualNetworkResourceId: parSpokeVirtualNetworkResourceId
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Parameter name | Required | Description
-------------- | -------- | -----------
parSpokeVirtualNetworkResourceId | No | The Spoke Virtual Network Resource ID.
parPrivateDnsZoneResourceIds | No | The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.
parPrivateDnsZoneResourceId | No | The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.

### parSpokeVirtualNetworkResourceId

Expand All @@ -15,12 +15,14 @@ The Spoke Virtual Network Resource ID.

- Default value: `/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/<RG-NAME>/providers/Microsoft.Network/virtualNetworks/<VNET-NAME>`

### parPrivateDnsZoneResourceIds
### parPrivateDnsZoneResourceId

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

The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.

- Default value: `/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/<RG-NAME>/providers/Microsoft.Network/privateDnsZones/<ZONE-NAME>`

## Snippets

### Parameter file
Expand All @@ -36,8 +38,8 @@ The Private DNS Zone Resource IDs to associate with the spoke Virtual Network.
"parSpokeVirtualNetworkResourceId": {
"value": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/<RG-NAME>/providers/Microsoft.Network/virtualNetworks/<VNET-NAME>"
},
"parPrivateDnsZoneResourceIds": {
"value": []
"parPrivateDnsZoneResourceId": {
"value": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/<RG-NAME>/providers/Microsoft.Network/privateDnsZones/<ZONE-NAME>"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ module modSpokeNetworking '../../modules/spokeNetworking/spokeNetworking.bicep'
}

// Module - Private DNS Zone Virtual Network Link to Spoke
module modPrivateDnsZoneLinkToSpoke '../../modules/privateDnsZoneLinks/privateDnsZoneLinks.bicep' = [for zones in parPrivateDnsZoneResourceIds: if (!empty(parPrivateDnsZoneResourceIds)) {
scope: resourceGroup(split(zones, '/')[1], split(zones, '/')[4] )
name: take('${varModuleDeploymentNames.modPrivateDnsZoneLinkToSpoke}-${uniqueString(zones)}', 64)
module modPrivateDnsZoneLinkToSpoke '../../modules/privateDnsZoneLinks/privateDnsZoneLinks.bicep' = [for zone in parPrivateDnsZoneResourceIds: if (!empty(parPrivateDnsZoneResourceIds)) {
scope: resourceGroup(split(zone, '/')[2], split(zone, '/')[4] )
name: take('${varModuleDeploymentNames.modPrivateDnsZoneLinkToSpoke}-${uniqueString(zone)}', 64)
params: {
parPrivateDnsZoneResourceIds: parPrivateDnsZoneResourceIds
parPrivateDnsZoneResourceId: zone
parSpokeVirtualNetworkResourceId: modSpokeNetworking.outputs.outSpokeVirtualNetworkId
}
}]
Expand Down