Skip to content
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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{ps1,psm1,psd1}]
indent_style = space
indent_size = 4


2 changes: 1 addition & 1 deletion .github/workflows/PullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pwsh: ['7.1.3']
pwsh: ['7.1.3', '7.5.0']
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
# VALIDATE_TERRAFORM_TERRASCAN: true # disabled for now as does not support TF 1.3 optional(type, default)
VALIDATE_TERRAFORM_TFLINT: true
VALIDATE_YAML: true
VALIDATE_EDITORCONFIG: true
# VALIDATE_GO: true # Disabled because it down not work :(
# Additional settings:
# If a shell script is not executable, the bash-exec
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ templates/.test_azuredevops
templates/.test_github
.vscode/settings.json
/ALZ
.tools
.tools
9 changes: 9 additions & 0 deletions actions_bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ $null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'platyPS'
ModuleVersion = '0.12.0'
}))
# Required for Invoke-EABillingSPNPermissionsSetup to work
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'Az.Accounts'
ModuleVersion = '2.10.4'
}))
$null = $modulesToInstall.Add(([PSCustomObject]@{
ModuleName = 'Az.Resources'
ModuleVersion = '6.5.0'
}))

'Installing PowerShell Modules'
foreach ($module in $modulesToInstall) {
Expand Down
39 changes: 0 additions & 39 deletions docs/CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/ALZ.Settings.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# specify the minimum required major PowerShell version that the build script should validate
[version]$script:requiredPSVersion = '5.1.0'
[version]$script:requiredPSVersion = '7.1.3'
42 changes: 26 additions & 16 deletions src/ALZ/ALZ.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@
@{

# Script module or binary module file associated with this manifest.
RootModule = 'ALZ.psm1'
RootModule = 'ALZ.psm1'

# Version number of this module.
ModuleVersion = '0.1.0'
ModuleVersion = '0.1.0'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '74a4385f-281e-4776-bd7c-3b6a09d6ba63'
GUID = '74a4385f-281e-4776-bd7c-3b6a09d6ba63'

# Author of this module
Author = 'Microsoft Corporation'
Author = 'Microsoft Corporation'

# Company or vendor of this module
CompanyName = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'

# Copyright statement for this module
Copyright = '(c) Microsoft Corporation. All rights reserved.'
Copyright = '(c) Microsoft Corporation. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Azure Landing Zones Powershell Module'
Description = 'Azure Landing Zones Powershell Module'

CompatiblePSEditions = 'Core'

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '7.4'
PowerShellVersion = '7.4'

# Name of the PowerShell host required by this module
# PowerShellHostName = ''
Expand All @@ -53,7 +53,16 @@
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @()
RequiredModules = @(
@{
ModuleName = 'Az.Accounts'
ModuleVersion = '2.10.4'
},
@{
ModuleName = 'Az.Resources'
ModuleVersion = '6.5.0'
}
)

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Expand All @@ -71,19 +80,20 @@
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @(
FunctionsToExport = @(
'Test-AcceleratorRequirement',
'Deploy-Accelerator'
'Deploy-Accelerator',
'Invoke-EABillingSPNPermissionsSetup'
)

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()
Expand All @@ -95,7 +105,7 @@
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
PrivateData = @{

PSData = @{

Expand All @@ -112,7 +122,7 @@
LicenseUri = 'https://github.com/Azure/ALZ-PowerShell-Module/blob/main/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/Azure/ALZ-Powershell-Module'
ProjectUri = 'https://github.com/Azure/ALZ-PowerShell-Module'

# A URL to an icon representing this module.
IconUri = 'https://raw.githubusercontent.com/Azure/ALZ-PowerShell-Module/main/docs/rsz_alzlogo.png'
Expand Down
2 changes: 1 addition & 1 deletion src/ALZ/ALZ.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ foreach ($file in @($public + $private)) {


# export all public functions
Export-ModuleMember -Function $public.Basename -Alias *
Export-ModuleMember -Function $public.Basename -Alias *
22 changes: 11 additions & 11 deletions src/ALZ/Private/Config-Helpers/Convert-BicepConfigToInputConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,52 @@ function Convert-BicepConfigToInputConfig {
if ($PSCmdlet.ShouldProcess("Parse Interface Variables into Config", "modify")) {

$configItems = [PSCustomObject]@{}
if($appendToObject -ne $null) {
if ($appendToObject -ne $null) {
$configItems = $appendToObject
}

Write-Verbose $validators

foreach($variable in $bicepConfig.inputs.PSObject.Properties) {
foreach ($variable in $bicepConfig.inputs.PSObject.Properties) {
Write-Verbose "Parsing variable $($variable.Name)"
$description = $variable.Value.description

$configItem = [PSCustomObject]@{}
$configItem | Add-Member -NotePropertyName "Source" -NotePropertyValue $variable.Value.source
$configItem | Add-Member -NotePropertyName "Value" -NotePropertyValue ""

if($variable.Value.PSObject.Properties.Name -contains "sourceInput") {
if ($variable.Value.PSObject.Properties.Name -contains "sourceInput") {
$configItem | Add-Member -NotePropertyName "SourceInput" -NotePropertyValue $variable.Value.sourceInput
}

if($variable.Value.PSObject.Properties.Name -contains "pattern") {
if ($variable.Value.PSObject.Properties.Name -contains "pattern") {
$configItem | Add-Member -NotePropertyName "Pattern" -NotePropertyValue $variable.Value.pattern
}

if($variable.Value.PSObject.Properties.Name -contains "process") {
if ($variable.Value.PSObject.Properties.Name -contains "process") {
$configItem | Add-Member -NotePropertyName "Process" -NotePropertyValue $variable.Value.process
}

if($variable.Value.PSObject.Properties.Name -contains "default") {
if ($variable.Value.PSObject.Properties.Name -contains "default") {
$defaultValue = $variable.Value.default
$configItem | Add-Member -NotePropertyName "DefaultValue" -NotePropertyValue $defaultValue
}

if($variable.Value.PSObject.Properties.Name -contains "validation") {
if ($variable.Value.PSObject.Properties.Name -contains "validation") {
$validationType = $variable.Value.validation
$validator = $validators.PSObject.Properties[$validationType].Value
$description = "$description ($($validator.Description))"
Write-Verbose "Adding $($variable.Value.validation) validation for $($variable.Name). Validation type: $($validator.Type)"
if($validator.Type -eq "AllowedValues"){
if ($validator.Type -eq "AllowedValues") {
$configItem | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
}
if($validator.Type -eq "Valid"){
if ($validator.Type -eq "Valid") {
$configItem | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
}
$configItem | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
}

if($variable.Value.PSObject.Properties.Name -contains "targets") {
if ($variable.Value.PSObject.Properties.Name -contains "targets") {
$configItem | Add-Member -NotePropertyName "targets" -NotePropertyValue $variable.Value.targets
}

Expand All @@ -69,4 +69,4 @@ function Convert-BicepConfigToInputConfig {
}

return $configItems
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ function Convert-HCLVariablesToInputConfig {
if ($PSCmdlet.ShouldProcess("Parse HCL Variables into Config", "modify")) {
$terraformVariables = & $hclParserToolPath $targetVariableFile | ConvertFrom-Json

if($terraformVariables.PSObject.Properties.Name -notcontains "variable") {
if ($terraformVariables.PSObject.Properties.Name -notcontains "variable") {
Write-Verbose "No variables found in $targetVariableFile, skipping..."
return $appendToObject
}

Write-Verbose "Variables found in $targetVariableFile, processing..."

$configItems = [PSCustomObject]@{}
if($appendToObject -ne $null) {
if ($appendToObject -ne $null) {
$configItems = $appendToObject
}

foreach($variable in $terraformVariables.variable.PSObject.Properties) {
if($variable.Value[0].PSObject.Properties.Name -contains "description") {
foreach ($variable in $terraformVariables.variable.PSObject.Properties) {
if ($variable.Value[0].PSObject.Properties.Name -contains "description") {
$description = $variable.Value[0].description
$validationTypeSplit = $description -split "\|"

$hasValidation = $false

if($validationTypeSplit.Length -gt 1) {
if ($validationTypeSplit.Length -gt 1) {
$description = $validationTypeSplit[0].Trim()
}

if($validationTypeSplit.Length -eq 2) {
if ($validationTypeSplit.Length -eq 2) {
$splitItem = $validationTypeSplit[1].Trim()
$validationType = $splitItem
$hasValidation = $true
Expand All @@ -51,17 +51,17 @@ function Convert-HCLVariablesToInputConfig {
$configItem | Add-Member -NotePropertyName "Value" -NotePropertyValue ""
$configItem | Add-Member -NotePropertyName "Source" -NotePropertyValue "input"

if($variable.Value[0].PSObject.Properties.Name -contains "default") {
if ($variable.Value[0].PSObject.Properties.Name -contains "default") {
$configItem | Add-Member -NotePropertyName "DefaultValue" -NotePropertyValue $variable.Value[0].default
}

if($hasValidation) {
if ($hasValidation) {
$validator = $validators.PSObject.Properties[$validationType].Value
$description = "$description ($($validator.Description))"
if($validator.Type -eq "AllowedValues"){
if ($validator.Type -eq "AllowedValues") {
$configItem | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
}
if($validator.Type -eq "Valid"){
if ($validator.Type -eq "Valid") {
$configItem | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
}
$configItem | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
Expand All @@ -75,4 +75,4 @@ function Convert-HCLVariablesToInputConfig {
}

return $configItems
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ function Convert-ParametersToInputConfig {
[hashtable] $parameters
)

foreach($parameterKey in $parameters.Keys) {
foreach ($parameterKey in $parameters.Keys) {
$parameter = $parameters[$parameterKey]
Write-Verbose "Processing parameter $parameterKey $(ConvertTo-Json $parameter -Depth 100)"

foreach($parameterAlias in $parameter.aliases) {
if($inputConfig.PsObject.Properties.Name -contains $parameterAlias) {
foreach ($parameterAlias in $parameter.aliases) {
if ($inputConfig.PsObject.Properties.Name -contains $parameterAlias) {
Write-Verbose "Alias $parameterAlias exists in input config, renaming..."
$configItem = $inputConfig.PSObject.Properties | Where-Object { $_.Name -eq $parameterAlias }
$inputConfig | Add-Member -NotePropertyName $parameterKey -NotePropertyValue @{
Expand All @@ -23,17 +23,17 @@ function Convert-ParametersToInputConfig {
}
}

if($inputConfig.PsObject.Properties.Name -notcontains $parameterKey) {
if ($inputConfig.PsObject.Properties.Name -notcontains $parameterKey) {
$variableValue = [Environment]::GetEnvironmentVariable("ALZ_$($parameterKey)")
if($null -eq $variableValue) {
if($parameter.type -eq "SwitchParameter") {
if ($null -eq $variableValue) {
if ($parameter.type -eq "SwitchParameter") {
$variableValue = $parameter.value.IsPresent
} else {
$variableValue = $parameter.value
}
}

if($parameter.type -eq "SwitchParameter") {
if ($parameter.type -eq "SwitchParameter") {
$variableValue = [bool]::Parse($variableValue)
}
Write-Verbose "Adding parameter $parameterKey with value $variableValue"
Expand All @@ -45,4 +45,4 @@ function Convert-ParametersToInputConfig {
}

return $inputConfig
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ function Format-TokenizedConfigurationString {
}

return $returnValue
}
}
Loading
Loading