From 4b766dabeb2b1cbe9bc6090fd09f1917af46c89f Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 2 Sep 2022 18:13:21 +0200 Subject: [PATCH 1/6] Updated ProximityPlacementGroup to new dependency structure --- .../ms.compute.proximityplacementgroups.yml | 3 +- .../.test/default/dependencies.bicep | 14 +++++ .../.test/default/deploy.test.bicep | 54 +++++++++++++++++++ .../.test/parameters.json | 22 -------- .../proximityPlacementGroups/readme.md | 12 ++--- 5 files changed, 75 insertions(+), 30 deletions(-) create mode 100644 modules/Microsoft.Compute/proximityPlacementGroups/.test/default/dependencies.bicep create mode 100644 modules/Microsoft.Compute/proximityPlacementGroups/.test/default/deploy.test.bicep delete mode 100644 modules/Microsoft.Compute/proximityPlacementGroups/.test/parameters.json diff --git a/.github/workflows/ms.compute.proximityplacementgroups.yml b/.github/workflows/ms.compute.proximityplacementgroups.yml index 969a9b9180..08e3be1444 100644 --- a/.github/workflows/ms.compute.proximityplacementgroups.yml +++ b/.github/workflows/ms.compute.proximityplacementgroups.yml @@ -106,8 +106,7 @@ jobs: - name: 'Using test file [${{ matrix.moduleTestFilePaths }}]' uses: ./.github/actions/templates/validateModuleDeployment with: - templateFilePath: '${{ env.modulePath }}/deploy.bicep' - parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' + templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' location: '${{ env.location }}' resourceGroupName: '${{ env.resourceGroupName }}' subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/.test/default/dependencies.bicep b/modules/Microsoft.Compute/proximityPlacementGroups/.test/default/dependencies.bicep new file mode 100644 index 0000000000..7371d4437b --- /dev/null +++ b/modules/Microsoft.Compute/proximityPlacementGroups/.test/default/dependencies.bicep @@ -0,0 +1,14 @@ +@description('Optional. The location to deploy to.') +param location string = resourceGroup().location + +@description('Required. The name of the Managed Identity to create.') +param managedIdentityName string + +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { + name: managedIdentityName + location: location +} + +@description('The principal ID of the created Managed Identity.') +output managedIdentityPrincipalId string = managedIdentity.properties.principalId + diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/.test/default/deploy.test.bicep b/modules/Microsoft.Compute/proximityPlacementGroups/.test/default/deploy.test.bicep new file mode 100644 index 0000000000..c2a6ad7ae8 --- /dev/null +++ b/modules/Microsoft.Compute/proximityPlacementGroups/.test/default/deploy.test.bicep @@ -0,0 +1,54 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.compute.proximityplacementgroups-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to') +param location string = deployment().location + +@description('Optional. A short identifier for the kind of deployment .Should be kept short to not run into resource-name length-constraints') +param serviceShort string = 'cppgdef' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +module resourceGroupResources 'dependencies.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name, location)}-paramNested' + params: { + managedIdentityName: 'dep-<>-msi-${serviceShort}' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + lock: 'CanNotDelete' + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + } +} diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/.test/parameters.json b/modules/Microsoft.Compute/proximityPlacementGroups/.test/parameters.json deleted file mode 100644 index 48ab4ed9c9..0000000000 --- a/modules/Microsoft.Compute/proximityPlacementGroups/.test/parameters.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-ppg-x-001" - }, - "lock": { - "value": "CanNotDelete" - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - } - } -} diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/readme.md b/modules/Microsoft.Compute/proximityPlacementGroups/readme.md index a7d0e7cade..9b6794bc47 100644 --- a/modules/Microsoft.Compute/proximityPlacementGroups/readme.md +++ b/modules/Microsoft.Compute/proximityPlacementGroups/readme.md @@ -155,7 +155,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: The name of each example is based on the name of the file from which it is taken. >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Parameters

+

Example 1: Default

@@ -163,16 +163,16 @@ The following module usage examples are retrieved from the content of the files ```bicep module proximityPlacementGroups './Microsoft.Compute/proximityPlacementGroups/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-ProximityPlacementGroups' + name: '${uniqueString(deployment().name)}-test-cppgdef' params: { // Required parameters - name: '<>-az-ppg-x-001' + name: '<>cppgdef001' // Non-required parameters lock: 'CanNotDelete' roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } @@ -195,7 +195,7 @@ module proximityPlacementGroups './Microsoft.Compute/proximityPlacementGroups/de "parameters": { // Required parameters "name": { - "value": "<>-az-ppg-x-001" + "value": "<>cppgdef001" }, // Non-required parameters "lock": { @@ -205,7 +205,7 @@ module proximityPlacementGroups './Microsoft.Compute/proximityPlacementGroups/de "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } From b83ffcd0c0ba6f649c3eb6853d63e579cefcdd83 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 8 Sep 2022 18:58:41 +0200 Subject: [PATCH 2/6] Updated folder default to common. --- .../.test/{default => common}/dependencies.bicep | 0 .../.test/{default => common}/deploy.test.bicep | 0 modules/Microsoft.Compute/proximityPlacementGroups/readme.md | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename modules/Microsoft.Compute/proximityPlacementGroups/.test/{default => common}/dependencies.bicep (100%) rename modules/Microsoft.Compute/proximityPlacementGroups/.test/{default => common}/deploy.test.bicep (100%) diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/.test/default/dependencies.bicep b/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/dependencies.bicep similarity index 100% rename from modules/Microsoft.Compute/proximityPlacementGroups/.test/default/dependencies.bicep rename to modules/Microsoft.Compute/proximityPlacementGroups/.test/common/dependencies.bicep diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/.test/default/deploy.test.bicep b/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep similarity index 100% rename from modules/Microsoft.Compute/proximityPlacementGroups/.test/default/deploy.test.bicep rename to modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/readme.md b/modules/Microsoft.Compute/proximityPlacementGroups/readme.md index 9b6794bc47..c9695deb23 100644 --- a/modules/Microsoft.Compute/proximityPlacementGroups/readme.md +++ b/modules/Microsoft.Compute/proximityPlacementGroups/readme.md @@ -155,7 +155,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: The name of each example is based on the name of the file from which it is taken. >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Default

+

Example 1: Common

From 88dcb79491d028280f522d194d336fc6c51ae003 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 12:50:09 +0200 Subject: [PATCH 3/6] Update to latest --- .../proximityPlacementGroups/.test/common/deploy.test.bicep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep b/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep index c2a6ad7ae8..6ff0bc1e9c 100644 --- a/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep @@ -10,8 +10,8 @@ param resourceGroupName string = 'ms.compute.proximityplacementgroups-${serviceS @description('Optional. The location to deploy resources to') param location string = deployment().location -@description('Optional. A short identifier for the kind of deployment .Should be kept short to not run into resource-name length-constraints') -param serviceShort string = 'cppgdef' +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +param serviceShort string = 'cppgcom' // =========== // // Deployments // From 171eb58fc3581c053b9bce921d935d36f15a3af8 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 13:03:04 +0200 Subject: [PATCH 4/6] Update to latest --- .../proximityPlacementGroups/.test/common/deploy.test.bicep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep b/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep index 6ff0bc1e9c..1b30a3664e 100644 --- a/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep @@ -3,14 +3,14 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes') +@description('Optional. The name of the resource group to deploy for a testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.compute.proximityplacementgroups-${serviceShort}-rg' -@description('Optional. The location to deploy resources to') +@description('Optional. The location to deploy resources to.') param location string = deployment().location -@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') param serviceShort string = 'cppgcom' // =========== // From 130235ba705b75f4112fa57beb98d91978d9e938 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 13:26:55 +0200 Subject: [PATCH 5/6] Update to latest --- .../Microsoft.Compute/proximityPlacementGroups/readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/readme.md b/modules/Microsoft.Compute/proximityPlacementGroups/readme.md index 3b46b6885c..845bd740e3 100644 --- a/modules/Microsoft.Compute/proximityPlacementGroups/readme.md +++ b/modules/Microsoft.Compute/proximityPlacementGroups/readme.md @@ -164,10 +164,10 @@ The following module usage examples are retrieved from the content of the files ```bicep module proximityPlacementGroups './Microsoft.Compute/proximityPlacementGroups/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-test-cppgdef' + name: '${uniqueString(deployment().name)}-test-cppgcom' params: { // Required parameters - name: '<>cppgdef001' + name: '<>cppgcom001' // Non-required parameters lock: 'CanNotDelete' roleAssignments: [ @@ -196,7 +196,7 @@ module proximityPlacementGroups './Microsoft.Compute/proximityPlacementGroups/de "parameters": { // Required parameters "name": { - "value": "<>cppgdef001" + "value": "<>cppgcom001" }, // Non-required parameters "lock": { From 1c306f08f967194227971895a273c752ba61fb1d Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Mon, 19 Sep 2022 08:23:50 +0200 Subject: [PATCH 6/6] Update modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep --- .../proximityPlacementGroups/.test/common/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep b/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep index 1b30a3664e..7f5ed2517c 100644 --- a/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Compute/proximityPlacementGroups/.test/common/deploy.test.bicep @@ -3,7 +3,7 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes.') +@description('Optional. The name of the resource group to deploy for testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.compute.proximityplacementgroups-${serviceShort}-rg'