From 3e052fe041dae5a27f820f17f0194a997e3cce46 Mon Sep 17 00:00:00 2001 From: Jack Tracey Date: Wed, 3 May 2023 14:22:43 +0100 Subject: [PATCH 1/3] fixes double loop --- .../modules/privateDnsZoneLinks/privateDnsZoneLinks.bicep | 8 ++++---- .../orchestration/hubPeeredSpoke/hubPeeredSpoke.bicep | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/infra-as-code/bicep/modules/privateDnsZoneLinks/privateDnsZoneLinks.bicep b/infra-as-code/bicep/modules/privateDnsZoneLinks/privateDnsZoneLinks.bicep index 04dc2a7d5..b36c5e6fa 100644 --- a/infra-as-code/bicep/modules/privateDnsZoneLinks/privateDnsZoneLinks.bicep +++ b/infra-as-code/bicep/modules/privateDnsZoneLinks/privateDnsZoneLinks.bicep @@ -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 } } -}] +} diff --git a/infra-as-code/bicep/orchestration/hubPeeredSpoke/hubPeeredSpoke.bicep b/infra-as-code/bicep/orchestration/hubPeeredSpoke/hubPeeredSpoke.bicep index 5086a3b77..c1add438d 100644 --- a/infra-as-code/bicep/orchestration/hubPeeredSpoke/hubPeeredSpoke.bicep +++ b/infra-as-code/bicep/orchestration/hubPeeredSpoke/hubPeeredSpoke.bicep @@ -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 } }] From 0607eda10d766ce3cf2eda5b51354c51d31f6aca Mon Sep 17 00:00:00 2001 From: Jack Tracey Date: Wed, 3 May 2023 14:45:57 +0100 Subject: [PATCH 2/3] fix sample --- .../modules/privateDnsZoneLinks/samples/baseline.sample.bicep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/baseline.sample.bicep b/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/baseline.sample.bicep index 454834651..1e37ab360 100644 --- a/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/baseline.sample.bicep +++ b/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/baseline.sample.bicep @@ -14,7 +14,7 @@ targetScope = 'resourceGroup' param parSpokeVirtualNetworkResourceId string = '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups//providers/Microsoft.Network/virtualNetworks/' @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//providers/Microsoft.Network/privateDnsZones/' // --------- // RESOURCES @@ -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 } } From a505fb90e245a3c5b2a8dd2f665db5f6da539581 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 3 May 2023 14:00:47 +0000 Subject: [PATCH 3/3] Generate Parameter Markdowns [jtracey93/ad33c272] --- .../generateddocs/privateDnsZoneLinks.bicep.md | 8 ++++---- .../samples/generateddocs/baseline.sample.bicep.md | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/infra-as-code/bicep/modules/privateDnsZoneLinks/generateddocs/privateDnsZoneLinks.bicep.md b/infra-as-code/bicep/modules/privateDnsZoneLinks/generateddocs/privateDnsZoneLinks.bicep.md index fb48a8360..d8e1c9999 100644 --- a/infra-as-code/bicep/modules/privateDnsZoneLinks/generateddocs/privateDnsZoneLinks.bicep.md +++ b/infra-as-code/bicep/modules/privateDnsZoneLinks/generateddocs/privateDnsZoneLinks.bicep.md @@ -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 @@ -13,7 +13,7 @@ parPrivateDnsZoneResourceIds | No | The Private DNS Zone Resource IDs to a The Spoke Virtual Network Resource ID. -### parPrivateDnsZoneResourceIds +### parPrivateDnsZoneResourceId ![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square) @@ -34,8 +34,8 @@ The Private DNS Zone Resource IDs to associate with the spoke Virtual Network. "parSpokeVirtualNetworkResourceId": { "value": "" }, - "parPrivateDnsZoneResourceIds": { - "value": [] + "parPrivateDnsZoneResourceId": { + "value": "" } } } diff --git a/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/generateddocs/baseline.sample.bicep.md b/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/generateddocs/baseline.sample.bicep.md index 7566b3f32..0c45d774b 100644 --- a/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/generateddocs/baseline.sample.bicep.md +++ b/infra-as-code/bicep/modules/privateDnsZoneLinks/samples/generateddocs/baseline.sample.bicep.md @@ -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 @@ -15,12 +15,14 @@ The Spoke Virtual Network Resource ID. - Default value: `/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups//providers/Microsoft.Network/virtualNetworks/` -### 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//providers/Microsoft.Network/privateDnsZones/` + ## Snippets ### Parameter file @@ -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//providers/Microsoft.Network/virtualNetworks/" }, - "parPrivateDnsZoneResourceIds": { - "value": [] + "parPrivateDnsZoneResourceId": { + "value": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups//providers/Microsoft.Network/privateDnsZones/" } } }