Skip to content

Commit

Permalink
Enforce location when deploying VM with zones
Browse files Browse the repository at this point in the history
  • Loading branch information
cecheta committed Aug 14, 2024
1 parent dbad5de commit fc450e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions avm/ptn/ai-platform/baseline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ module baseline 'br/public:avm/ptn/ai-platform/baseline:<version>' = {
}
patchMode: 'AutomaticByPlatform'
size: 'Standard_DS1_v2'
zone: 1
zone: 0
}
virtualNetworkConfiguration: {
addressPrefix: '10.1.0.0/16'
Expand Down Expand Up @@ -369,7 +369,7 @@ module baseline 'br/public:avm/ptn/ai-platform/baseline:<version>' = {
},
"patchMode": "AutomaticByPlatform",
"size": "Standard_DS1_v2",
"zone": 1
"zone": 0
}
},
"virtualNetworkConfiguration": {
Expand Down
2 changes: 1 addition & 1 deletion avm/ptn/ai-platform/baseline/tests/e2e/max/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module testDeployment '../../../main.bicep' = [
virtualMachineConfiguration: {
enabled: true
name: take('${namePrefix}-vm-${serviceShort}', 15)
zone: 1
zone: 0
size: 'Standard_DS1_v2'
adminUsername: username
adminPassword: password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ metadata description = 'This instance deploys the module in alignment with the b
@maxLength(90)
param resourceGroupName string = 'dep-${namePrefix}-aiplatform-baseline-${serviceShort}-rg'

@description('Optional. The location to deploy resources to.')
param resourceLocation string = deployment().location
// Enforce uksouth to avoid restrictions around VM zones in certain regions
#disable-next-line no-hardcoded-location
var enforcedLocation = 'uksouth'

@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 = 'aipbwaf'
Expand All @@ -39,16 +40,16 @@ param password string = newGuid()
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: resourceLocation
location: enforcedLocation
}

module nestedDependencies 'dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, resourceLocation)}-nestedDependencies'
name: '${uniqueString(deployment().name, enforcedLocation)}-nestedDependencies'
params: {
storageAccountName: 'dep${namePrefix}st${serviceShort}'
maintenanceConfigurationName: 'dep-${namePrefix}-mc-${serviceShort}'
location: resourceLocation
location: enforcedLocation
}
}

Expand All @@ -60,7 +61,7 @@ module nestedDependencies 'dependencies.bicep' = {
module testDeployment '../../../main.bicep' = [
for iteration in ['init', 'idem']: {
scope: resourceGroup
name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}-${iteration}'
name: '${uniqueString(deployment().name, enforcedLocation)}-test-${serviceShort}-${iteration}'
params: {
name: '${namePrefix}${serviceShort}${substring(uniqueString(baseTime), 0, 3)}'
virtualMachineConfiguration: {
Expand Down

0 comments on commit fc450e4

Please sign in to comment.