diff --git a/.github/workflows/ms.authorization.locks.yml b/.github/workflows/ms.authorization.locks.yml index 0372a1090d..0f274136fc 100644 --- a/.github/workflows/ms.authorization.locks.yml +++ b/.github/workflows/ms.authorization.locks.yml @@ -109,8 +109,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.Authorization/locks/.test/common/deploy.test.bicep b/modules/Microsoft.Authorization/locks/.test/common/deploy.test.bicep new file mode 100644 index 0000000000..6509778d79 --- /dev/null +++ b/modules/Microsoft.Authorization/locks/.test/common/deploy.test.bicep @@ -0,0 +1,38 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(80) +param resourceGroupName string = 'ms.authorization.locks-${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 = 'alcom' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + level: 'CanNotDelete' + resourceGroupName: resourceGroup.name + subscriptionId: subscription().subscriptionId + } +} diff --git a/modules/Microsoft.Authorization/locks/.test/rg.parameters.json b/modules/Microsoft.Authorization/locks/.test/rg.parameters.json deleted file mode 100644 index dc4870ce99..0000000000 --- a/modules/Microsoft.Authorization/locks/.test/rg.parameters.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "level": { - "value": "CanNotDelete" - }, - "resourceGroupName": { - "value": "adp-<>-az-locks-rg-001" - }, - "subscriptionId": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/locks/readme.md b/modules/Microsoft.Authorization/locks/readme.md index a6e0adea95..8d25b60f2c 100644 --- a/modules/Microsoft.Authorization/locks/readme.md +++ b/modules/Microsoft.Authorization/locks/readme.md @@ -52,7 +52,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Rg

+

Example 1: Common

@@ -60,13 +60,13 @@ The following module usage examples are retrieved from the content of the files ```bicep module locks './Microsoft.Authorization/locks/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-Locks' + name: '${uniqueString(deployment().name)}-test-alcom' params: { // Required parameters level: 'CanNotDelete' // Non-required parameters - resourceGroupName: 'adp-<>-az-locks-rg-001' - subscriptionId: '<>' + resourceGroupName: '' + subscriptionId: '' } } ``` @@ -89,10 +89,10 @@ module locks './Microsoft.Authorization/locks/deploy.bicep' = { }, // Non-required parameters "resourceGroupName": { - "value": "adp-<>-az-locks-rg-001" + "value": "" }, "subscriptionId": { - "value": "<>" + "value": "" } } }