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: SQL Instance Pool - hard coding location of tests to make sure pipeline succeeds #1748

Merged
merged 3 commits into from
Apr 25, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/avm.res.sql.instance-pool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
removeDeployment:
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:
Expand Down
14 changes: 9 additions & 5 deletions avm/res/sql/instance-pool/tests/e2e/defaults/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand All @@ -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 //
// ============ //
Expand All @@ -29,20 +33,20 @@ 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}'
pairedRegionScriptName: 'dep-${namePrefix}-ds-${serviceShort}'
nsgName: 'dep-${namePrefix}-nsg-${serviceShort}'
routeTableName: 'dep-${namePrefix}-rt-${serviceShort}'
sqlInstancePoolName: '${namePrefix}${serviceShort}001'
location: resourceLocation
location: tempLocation
}
}

Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand All @@ -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 //
// ============ //
Expand All @@ -29,20 +33,20 @@ 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}'
pairedRegionScriptName: 'dep-${namePrefix}-ds-${serviceShort}'
nsgName: 'dep-${namePrefix}-nsg-${serviceShort}'
routeTableName: 'dep-${namePrefix}-rt-${serviceShort}'
sqlInstancePoolName: '${namePrefix}${serviceShort}001'
location: resourceLocation
location: tempLocation
}
}

Expand All @@ -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
}
Expand Down