Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@
"type": "object",
"required": true,
"properties": {
"management": {
"description": "The subscription ID for the Management subscription where logging, monitoring, and automation resources will be deployed",
"connectivity": {
"description": "The subscription ID for the Connectivity subscription where networking resources like hubs, firewalls, and DNS will be deployed",
"type": "guid",
"required": true,
"source": "subscription"
},
"identity": {
"description": "The subscription ID for the Identity subscription where identity resources like domain controllers will be deployed",
"type": "guid",
"required": true,
"required": false,
"source": "subscription"
},
"connectivity": {
"description": "The subscription ID for the Connectivity subscription where networking resources like hubs, firewalls, and DNS will be deployed",
"management": {
"description": "The subscription ID for the Management subscription where logging, monitoring, and automation resources will be deployed",
"type": "guid",
"required": true,
"source": "subscription"
},
"security": {
"description": "The subscription ID for the Security subscription where security monitoring and governance resources will be deployed",
"type": "guid",
"required": true,
"required": false,
"source": "subscription"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ function Request-ALZConfigurationValue {
$menuParams.ManualEntryPrompt = "Enter subscription ID"
$menuParams.RequiredMessage = "This field is required. Please select a subscription."
$menuParams.EmptyMessage = "No subscriptions found in Azure context."
if (-not $isRequired) {
$menuParams.ManualEntryLabel = "Enter manually or don't supply"
$menuParams.DefaultToManualEntry = $true
$menuParams.DefaultValue = ""
}
} elseif ($source -eq "managementGroup") {
$menuParams.OptionsTitle = "Available management groups:"
$menuParams.Options = $AzureContext.ManagementGroups
Expand Down Expand Up @@ -252,15 +257,13 @@ function Request-ALZConfigurationValue {
continue
}

foreach ($subKey in @($currentValue.Keys)) {
$subCurrentValue = $currentValue[$subKey]
$subSchemaInfo = $null

if ($nestedSchema.PSObject.Properties.Name -contains $subKey) {
$subSchemaInfo = $nestedSchema.$subKey
} else {
# Iterate using schema property order to ensure consistent display ordering
foreach ($subKey in @($nestedSchema.PSObject.Properties.Name)) {
if (-not $currentValue.Contains($subKey)) {
continue
}
$subCurrentValue = $currentValue[$subKey]
$subSchemaInfo = $nestedSchema.$subKey

$result = Read-InputValue -Key $subKey -CurrentValue $subCurrentValue -SchemaInfo $subSchemaInfo -DefaultDescription "$key - $subKey" -AzureContext $AzureContext
$subNewValue = $result.Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,8 @@ function Request-AcceleratorConfigurationInput {

# Prompt for scenario number (Terraform only)
if ($selectedIacType -eq "terraform") {
$scenarioOptions = @(
@{ label = "1 - Full Multi-Region - Hub and Spoke VNet"; value = 1 },
@{ label = "2 - Full Multi-Region - Virtual WAN"; value = 2 },
@{ label = "3 - Full Multi-Region NVA - Hub and Spoke VNet"; value = 3 },
@{ label = "4 - Full Multi-Region NVA - Virtual WAN"; value = 4 },
@{ label = "5 - Management Only"; value = 5 },
@{ label = "6 - Full Single-Region - Hub and Spoke VNet"; value = 6 },
@{ label = "7 - Full Single-Region - Virtual WAN"; value = 7 },
@{ label = "8 - Full Single-Region NVA - Hub and Spoke VNet"; value = 8 },
@{ label = "9 - Full Single-Region NVA - Virtual WAN"; value = 9 }
)
$scenariosJsonPath = Join-Path $PSScriptRoot "TerraformScenarios.json"
$scenarioOptions = Get-Content -Path $scenariosJsonPath -Raw | ConvertFrom-Json

$selectedScenarioNumber = Read-MenuSelection `
-Title "Select the Terraform scenario (see https://aka.ms/alz/acc/scenarios):" `
Expand Down
13 changes: 13 additions & 0 deletions src/ALZ/Private/Deploy-Accelerator-Helpers/TerraformScenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{ "label": "1 - Full Multi-Region - Hub and Spoke VNet", "value": 1 },
{ "label": "2 - Full Multi-Region - Virtual WAN", "value": 2 },
{ "label": "3 - Full Multi-Region NVA - Hub and Spoke VNet", "value": 3 },
{ "label": "4 - Full Multi-Region NVA - Virtual WAN", "value": 4 },
{ "label": "5 - Management Only", "value": 5 },
{ "label": "6 - Full Single-Region - Hub and Spoke VNet", "value": 6 },
{ "label": "7 - Full Single-Region - Virtual WAN", "value": 7 },
{ "label": "8 - Full Single-Region NVA - Hub and Spoke VNet", "value": 8 },
{ "label": "9 - Full Single-Region NVA - Virtual WAN", "value": 9 },
{ "label": "10 - SMB Single-Region - Hub and Spoke VNet", "value": 10 },
{ "label": "11 - SMB Single-Region - Virtual WAN", "value": 11 }
]
28 changes: 24 additions & 4 deletions src/ALZ/Private/Shared/Read-MenuSelection.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ function Read-MenuSelection {
[Parameter(Mandatory = $false)]
[switch] $AllowManualEntry,

[Parameter(Mandatory = $false)]
[string] $ManualEntryLabel = "Enter manually",

[Parameter(Mandatory = $false)]
[switch] $DefaultToManualEntry,

[Parameter(Mandatory = $false)]
[string] $ManualEntryPrompt = "Enter value",

Expand Down Expand Up @@ -331,7 +337,12 @@ function Read-MenuSelection {

# Show manual entry option if allowed
if ($AllowManualEntry.IsPresent) {
Write-ToConsoleLog "[0] Enter manually" -IsSelection -IndentLevel 1
$manualEntryMarker = if ($DefaultToManualEntry.IsPresent) { " (current)" } else { "" }
if ($DefaultToManualEntry.IsPresent) {
Write-ToConsoleLog "[0] $ManualEntryLabel$manualEntryMarker" -IsSelection -Color Green -IndentLevel 1
} else {
Write-ToConsoleLog "[0] $ManualEntryLabel" -IsSelection -IndentLevel 1
}
}

# Build prompt text
Expand All @@ -340,16 +351,25 @@ function Read-MenuSelection {
if ($AllowManualEntry.IsPresent) {
$promptText += ", 0 for manual entry"
}
$promptText += ", default: $($DefaultIndex + 1))"
if ($DefaultToManualEntry.IsPresent) {
$promptText += ", default: 0)"
} else {
$promptText += ", default: $($DefaultIndex + 1))"
}

# Get selection
$result = $null
do {
$selection = Read-InputValue -Prompt $promptText -Sensitive $IsSensitive.IsPresent

if ([string]::IsNullOrWhiteSpace($selection)) {
# Use default
$result = Get-OptionValue -Option $Options[$DefaultIndex]
if ($DefaultToManualEntry.IsPresent) {
# Default to manual entry - return DefaultValue (empty string)
$result = if ($null -ne $DefaultValue) { $DefaultValue } else { "" }
} else {
# Use default option
$result = Get-OptionValue -Option $Options[$DefaultIndex]
}
} elseif ($AllowManualEntry.IsPresent -and $selection -eq "0") {
# Manual entry
do {
Expand Down
Loading