From d9d1d031478771c8237d05d46238033cf3957991 Mon Sep 17 00:00:00 2001 From: Yaser Adel Mehraban Date: Wed, 24 Apr 2024 22:57:48 +0000 Subject: [PATCH 1/2] Fixing location of tests to make sure pipeline passes --- .github/workflows/avm.res.sql.instance-pool.yml | 3 +++ .../tests/e2e/defaults/main.test.bicep | 14 +++++++++----- .../tests/e2e/waf-aligned/main.test.bicep | 14 +++++++++----- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/avm.res.sql.instance-pool.yml b/.github/workflows/avm.res.sql.instance-pool.yml index 75f6103864..24bb104270 100644 --- a/.github/workflows/avm.res.sql.instance-pool.yml +++ b/.github/workflows/avm.res.sql.instance-pool.yml @@ -16,6 +16,9 @@ on: required: false default: true removeDeployment: + ### We had to set this to false because + ### the SQL Instance Pool takes more + ### than 24 hours to get deleted type: boolean description: "Remove deployed module" required: false diff --git a/avm/res/sql/instance-pool/tests/e2e/defaults/main.test.bicep b/avm/res/sql/instance-pool/tests/e2e/defaults/main.test.bicep index 677a80dbe1..3e801241ff 100644 --- a/avm/res/sql/instance-pool/tests/e2e/defaults/main.test.bicep +++ b/avm/res/sql/instance-pool/tests/e2e/defaults/main.test.bicep @@ -12,6 +12,7 @@ metadata description = 'This instance deploys the module with the minimum set of param resourceGroupName string = 'dep-${namePrefix}-sql.instancepool-${serviceShort}-rg' @description('Optional. The location to deploy resources to.') +#disable-next-line no-unused-params // A rotation location cannot be used for this test as the SQL Instance Pool deletion is not possible in the same deployment param resourceLocation 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.') @@ -21,6 +22,9 @@ param serviceShort string = 'sipmin' @description('Optional. A token to inject into the name of each resource. This value can be automatically injected by the CI.') param namePrefix string = '#_namePrefix_#' +@description('Optional. The static location of the resource group & resources.') // Note, we set the location of the SQL Instance Pool to avoid conflicts with the already existing ones +param tempLocation string = 'uksouth' + // ============ // // Dependencies // // ============ // @@ -29,12 +33,12 @@ param namePrefix string = '#_namePrefix_#' // ================= resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { name: resourceGroupName - location: resourceLocation + location: tempLocation } module nestedDependencies 'dependencies.bicep' = { scope: resourceGroup - name: '${uniqueString(deployment().name, resourceLocation)}-nestedDependencies' + name: '${uniqueString(deployment().name, tempLocation)}-nestedDependencies' params: { virtualNetworkName: 'dep-${namePrefix}-vnet-${serviceShort}' managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}' @@ -42,7 +46,7 @@ module nestedDependencies 'dependencies.bicep' = { nsgName: 'dep-${namePrefix}-nsg-${serviceShort}' routeTableName: 'dep-${namePrefix}-rt-${serviceShort}' sqlInstancePoolName: '${namePrefix}${serviceShort}001' - location: resourceLocation + location: tempLocation } } @@ -52,10 +56,10 @@ module nestedDependencies 'dependencies.bicep' = { module testDeployment '../../../main.bicep' = { scope: resourceGroup - name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}' + name: '${uniqueString(deployment().name, tempLocation)}-test-${serviceShort}' params: { name: nestedDependencies.outputs.sqlInstancePoolName - location: resourceLocation + location: tempLocation subnetResourceId: nestedDependencies.outputs.subnetId } } diff --git a/avm/res/sql/instance-pool/tests/e2e/waf-aligned/main.test.bicep b/avm/res/sql/instance-pool/tests/e2e/waf-aligned/main.test.bicep index ffaa207271..943e45acec 100644 --- a/avm/res/sql/instance-pool/tests/e2e/waf-aligned/main.test.bicep +++ b/avm/res/sql/instance-pool/tests/e2e/waf-aligned/main.test.bicep @@ -12,6 +12,7 @@ metadata description = 'This instance deploys the module in alignment with the b param resourceGroupName string = 'dep-${namePrefix}-sql.instancepool-${serviceShort}-rg' @description('Optional. The location to deploy resources to.') +#disable-next-line no-unused-params // A rotation location cannot be used for this test as the SQL Instance Pool deletion is not possible in the same deployment param resourceLocation 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.') @@ -21,6 +22,9 @@ param serviceShort string = 'sipwaf' @description('Optional. A token to inject into the name of each resource. This value can be automatically injected by the CI.') param namePrefix string = '#_namePrefix_#' +@description('Optional. The static location of the resource group & resources.') // Note, we set the location of the SQL Instance Pool to avoid conflicts with the already existing ones +param tempLocation string = 'northeurope' + // ============ // // Dependencies // // ============ // @@ -29,12 +33,12 @@ param namePrefix string = '#_namePrefix_#' // ================= resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { name: resourceGroupName - location: resourceLocation + location: tempLocation } module nestedDependencies 'dependencies.bicep' = { scope: resourceGroup - name: '${uniqueString(deployment().name, resourceLocation)}-nestedDependencies' + name: '${uniqueString(deployment().name, tempLocation)}-nestedDependencies' params: { virtualNetworkName: 'dep-${namePrefix}-vnet-${serviceShort}' managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}' @@ -42,7 +46,7 @@ module nestedDependencies 'dependencies.bicep' = { nsgName: 'dep-${namePrefix}-nsg-${serviceShort}' routeTableName: 'dep-${namePrefix}-rt-${serviceShort}' sqlInstancePoolName: '${namePrefix}${serviceShort}001' - location: resourceLocation + location: tempLocation } } @@ -52,10 +56,10 @@ module nestedDependencies 'dependencies.bicep' = { module testDeployment '../../../main.bicep' = { scope: resourceGroup - name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}' + name: '${uniqueString(deployment().name, tempLocation)}-test-${serviceShort}' params: { name: nestedDependencies.outputs.sqlInstancePoolName - location: resourceLocation + location: tempLocation skuName: 'GP_Gen8IM' subnetResourceId: nestedDependencies.outputs.subnetId } From e9e1fed261565e11bacc7942262e70cfbd68d048 Mon Sep 17 00:00:00 2001 From: Yaser Adel Mehraban Date: Thu, 25 Apr 2024 22:30:07 +0000 Subject: [PATCH 2/2] Moving the comment to one liner --- .github/workflows/avm.res.sql.instance-pool.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/avm.res.sql.instance-pool.yml b/.github/workflows/avm.res.sql.instance-pool.yml index 24bb104270..659c39b82a 100644 --- a/.github/workflows/avm.res.sql.instance-pool.yml +++ b/.github/workflows/avm.res.sql.instance-pool.yml @@ -16,11 +16,9 @@ on: required: false default: true removeDeployment: - ### We had to set this to false because - ### the SQL Instance Pool takes more - ### than 24 hours to get deleted type: boolean description: "Remove deployed module" + # We had to set this to false because the SQL Instance Pool takes more than 24 hours to get deleted required: false default: false push: