Skip to content

Commit 5942e5b

Browse files
fix: handle single item array (#422)
# Pull Request ## Issue Issue #, if available: #412 (comment) ## Description PowerShell Convert commands unboxes single item arrays, we need to handle that for the single item array (e.g. single region) ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent dffa2d8 commit 5942e5b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ALZ/Private/Config-Helpers/Set-Config.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ function Set-Config {
6565
# Handle integer index for arrays
6666
Write-Verbose "Handling integer index for array"
6767

68+
# Ensure single value array is treated as array
69+
if(!$inputConfigItemValueType.EndsWith("]")) {
70+
Write-Verbose "Converting single value to array for input config item $($inputConfigName)."
71+
$inputConfigItemValue = @($inputConfigItemValue)
72+
}
73+
6874
$index = [int]$indexString
6975
if($inputConfigItemValue.Length -le $index) {
7076
Write-Verbose "Input config item $($inputConfigName) does not have an index of $index."

0 commit comments

Comments
 (0)