Skip to content

Commit 7832440

Browse files
feat: add SMB scenarios 10 and 11, load scenarios from JSON config (#532)
## Summary Adds missing SMB scenarios 10 and 11 to the accelerator folder structure creation, and refactors scenario management to use the existing `TerraformScenarios.json` config file as the single source of truth. Closes Azure/Azure-Landing-Zones#4105 ## Changes ### TerraformScenarios.json - Added `path` property to each scenario entry, mapping scenario numbers to their tfvars file paths - Scenarios 10 and 11 were already present (labels only) — now they also have paths: - **10**: `smb-single-region/hub-and-spoke-vnet.tfvars` - **11**: `smb-single-region/virtual-wan.tfvars` ### New-AcceleratorFolderStructure.ps1 - Replaced hardcoded `` hashtable with dynamic loading from `TerraformScenarios.json` - Fixed `int64`/`int32` type mismatch when looking up scenario paths (JSON parser returns `int64`, parameter is `[int]`/`int32` — without the cast, hashtable lookup returns `` and `Copy-Item` creates a directory instead of copying the file)
1 parent 2190423 commit 7832440

2 files changed

Lines changed: 16 additions & 21 deletions

File tree

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[
2-
{ "label": "1 - Full Multi-Region - Hub and Spoke VNet", "value": 1 },
3-
{ "label": "2 - Full Multi-Region - Virtual WAN", "value": 2 },
4-
{ "label": "3 - Full Multi-Region NVA - Hub and Spoke VNet", "value": 3 },
5-
{ "label": "4 - Full Multi-Region NVA - Virtual WAN", "value": 4 },
6-
{ "label": "5 - Management Only", "value": 5 },
7-
{ "label": "6 - Full Single-Region - Hub and Spoke VNet", "value": 6 },
8-
{ "label": "7 - Full Single-Region - Virtual WAN", "value": 7 },
9-
{ "label": "8 - Full Single-Region NVA - Hub and Spoke VNet", "value": 8 },
10-
{ "label": "9 - Full Single-Region NVA - Virtual WAN", "value": 9 },
11-
{ "label": "10 - SMB Single-Region - Hub and Spoke VNet", "value": 10 },
12-
{ "label": "11 - SMB Single-Region - Virtual WAN", "value": 11 }
2+
{ "label": "Full Multi-Region - Hub and Spoke VNet", "value": 1, "path": "full-multi-region/hub-and-spoke-vnet.tfvars" },
3+
{ "label": "Full Multi-Region - Virtual WAN", "value": 2, "path": "full-multi-region/virtual-wan.tfvars" },
4+
{ "label": "Full Multi-Region NVA - Hub and Spoke VNet", "value": 3, "path": "full-multi-region-nva/hub-and-spoke-vnet.tfvars" },
5+
{ "label": "Full Multi-Region NVA - Virtual WAN", "value": 4, "path": "full-multi-region-nva/virtual-wan.tfvars" },
6+
{ "label": "Management Only", "value": 5, "path": "management-only/management.tfvars" },
7+
{ "label": "Full Single-Region - Hub and Spoke VNet", "value": 6, "path": "full-single-region/hub-and-spoke-vnet.tfvars" },
8+
{ "label": "Full Single-Region - Virtual WAN", "value": 7, "path": "full-single-region/virtual-wan.tfvars" },
9+
{ "label": "Full Single-Region NVA - Hub and Spoke VNet", "value": 8, "path": "full-single-region-nva/hub-and-spoke-vnet.tfvars" },
10+
{ "label": "Full Single-Region NVA - Virtual WAN", "value": 9, "path": "full-single-region-nva/virtual-wan.tfvars" },
11+
{ "label": "SMB Single-Region - Hub and Spoke VNet", "value": 10, "path": "smb-single-region/hub-and-spoke-vnet.tfvars" },
12+
{ "label": "SMB Single-Region - Virtual WAN", "value": 11, "path": "smb-single-region/virtual-wan.tfvars" }
1313
]

src/ALZ/Public/New-AcceleratorFolderStructure.ps1

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,11 @@ function New-AcceleratorFolderStructure {
130130

131131
# Copy the platform landing zone configuration files based on scenario number or specific file path
132132
if ($repo.hasScenarios) {
133-
$scenarios = @{
134-
1 = "full-multi-region/hub-and-spoke-vnet.tfvars"
135-
2 = "full-multi-region/virtual-wan.tfvars"
136-
3 = "full-multi-region-nva/hub-and-spoke-vnet.tfvars"
137-
4 = "full-multi-region-nva/virtual-wan.tfvars"
138-
5 = "management-only/management.tfvars"
139-
6 = "full-single-region/hub-and-spoke-vnet.tfvars"
140-
7 = "full-single-region/virtual-wan.tfvars"
141-
8 = "full-single-region-nva/hub-and-spoke-vnet.tfvars"
142-
9 = "full-single-region-nva/virtual-wan.tfvars"
133+
$scenariosJsonPath = Join-Path $PSScriptRoot ".." "Private" "Deploy-Accelerator-Helpers" "TerraformScenarios.json"
134+
$scenarioOptions = Get-Content -Path $scenariosJsonPath -Raw | ConvertFrom-Json
135+
$scenarios = @{}
136+
foreach ($scenario in $scenarioOptions) {
137+
$scenarios[[int]$scenario.value] = $scenario.path
143138
}
144139

145140
Write-ToConsoleLog "Copying platform landing zone configuration file for scenario $scenarioNumber to $($targetFolderPath)/config/platform-landing-zone.tfvars"

0 commit comments

Comments
 (0)