Skip to content

Commit 0c76c95

Browse files
committed
editorconfig fixes
1 parent 1827017 commit 0c76c95

23 files changed

Lines changed: 147 additions & 186 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ templates/.test_azuredevops
5454
templates/.test_github
5555
.vscode/settings.json
5656
/ALZ
57-
.tools
57+
.tools

docs/CHANGELOG.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/ALZ/ALZ.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ foreach ($file in @($public + $private)) {
2828

2929

3030
# export all public functions
31-
Export-ModuleMember -Function $public.Basename -Alias *
31+
Export-ModuleMember -Function $public.Basename -Alias *

src/ALZ/Private/Config-Helpers/Convert-BicepConfigToInputConfig.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,52 @@ function Convert-BicepConfigToInputConfig {
1414
if ($PSCmdlet.ShouldProcess("Parse Interface Variables into Config", "modify")) {
1515

1616
$configItems = [PSCustomObject]@{}
17-
if($appendToObject -ne $null) {
17+
if ($appendToObject -ne $null) {
1818
$configItems = $appendToObject
1919
}
2020

2121
Write-Verbose $validators
2222

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

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

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

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

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

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

48-
if($variable.Value.PSObject.Properties.Name -contains "validation") {
48+
if ($variable.Value.PSObject.Properties.Name -contains "validation") {
4949
$validationType = $variable.Value.validation
5050
$validator = $validators.PSObject.Properties[$validationType].Value
5151
$description = "$description ($($validator.Description))"
5252
Write-Verbose "Adding $($variable.Value.validation) validation for $($variable.Name). Validation type: $($validator.Type)"
53-
if($validator.Type -eq "AllowedValues"){
53+
if ($validator.Type -eq "AllowedValues") {
5454
$configItem | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
5555
}
56-
if($validator.Type -eq "Valid"){
56+
if ($validator.Type -eq "Valid") {
5757
$configItem | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
5858
}
5959
$configItem | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
6060
}
6161

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

@@ -69,4 +69,4 @@ function Convert-BicepConfigToInputConfig {
6969
}
7070

7171
return $configItems
72-
}
72+
}

src/ALZ/Private/Config-Helpers/Convert-HCLVariablesToInputConfig.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@ function Convert-HCLVariablesToInputConfig {
1717
if ($PSCmdlet.ShouldProcess("Parse HCL Variables into Config", "modify")) {
1818
$terraformVariables = & $hclParserToolPath $targetVariableFile | ConvertFrom-Json
1919

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

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

2727
$configItems = [PSCustomObject]@{}
28-
if($appendToObject -ne $null) {
28+
if ($appendToObject -ne $null) {
2929
$configItems = $appendToObject
3030
}
3131

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

3737
$hasValidation = $false
3838

39-
if($validationTypeSplit.Length -gt 1) {
39+
if ($validationTypeSplit.Length -gt 1) {
4040
$description = $validationTypeSplit[0].Trim()
4141
}
4242

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

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

58-
if($hasValidation) {
58+
if ($hasValidation) {
5959
$validator = $validators.PSObject.Properties[$validationType].Value
6060
$description = "$description ($($validator.Description))"
61-
if($validator.Type -eq "AllowedValues"){
61+
if ($validator.Type -eq "AllowedValues") {
6262
$configItem | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
6363
}
64-
if($validator.Type -eq "Valid"){
64+
if ($validator.Type -eq "Valid") {
6565
$configItem | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
6666
}
6767
$configItem | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
@@ -75,4 +75,4 @@ function Convert-HCLVariablesToInputConfig {
7575
}
7676

7777
return $configItems
78-
}
78+
}

src/ALZ/Private/Config-Helpers/Convert-ParametersToInputConfig.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ function Convert-ParametersToInputConfig {
66
[hashtable] $parameters
77
)
88

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

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

26-
if($inputConfig.PsObject.Properties.Name -notcontains $parameterKey) {
26+
if ($inputConfig.PsObject.Properties.Name -notcontains $parameterKey) {
2727
$variableValue = [Environment]::GetEnvironmentVariable("ALZ_$($parameterKey)")
28-
if($null -eq $variableValue) {
29-
if($parameter.type -eq "SwitchParameter") {
28+
if ($null -eq $variableValue) {
29+
if ($parameter.type -eq "SwitchParameter") {
3030
$variableValue = $parameter.value.IsPresent
3131
} else {
3232
$variableValue = $parameter.value
3333
}
3434
}
3535

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

4747
return $inputConfig
48-
}
48+
}

src/ALZ/Private/Config-Helpers/Format-TokenizedConfigurationString.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ function Format-TokenizedConfigurationString {
2323
}
2424

2525
return $returnValue
26-
}
26+
}

src/ALZ/Private/Config-Helpers/Get-ALZConfig.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ function Get-ALZConfig {
88
[string] $hclParserToolPath = ""
99
)
1010

11-
if(!(Test-Path $configFilePath)) {
11+
if (!(Test-Path $configFilePath)) {
1212
Write-Error "The config file does not exist at $configFilePath"
1313
throw "The config file does not exist at $configFilePath"
1414
}
1515

16-
if($null -eq $inputConfig) {
16+
if ($null -eq $inputConfig) {
1717
$inputConfig = [PSCustomObject]@{}
1818
}
1919

2020
# Import the config and transform it to a PowerShell object
2121
$extension = (Get-Item -Path $configFilePath).Extension.ToLower()
2222
$config = $null
23-
if($extension -eq ".yml" -or $extension -eq ".yaml") {
23+
if ($extension -eq ".yml" -or $extension -eq ".yaml") {
2424
if (!(Get-Module -ListAvailable -Name powershell-Yaml)) {
2525
Write-Host "Installing YAML module"
2626
Install-Module powershell-Yaml -Force
@@ -33,15 +33,15 @@ function Get-ALZConfig {
3333
throw $errorMessage
3434
}
3535

36-
} elseif($extension -eq ".json") {
36+
} elseif ($extension -eq ".json") {
3737
try {
3838
$config = [PSCustomObject](Get-Content -Path $configFilePath | ConvertFrom-Json)
3939
} catch {
4040
$errorMessage = "Failed to parse JSON inputs. Please check the JSON file for errors and try again. $_"
4141
Write-Error $errorMessage
4242
throw $errorMessage
4343
}
44-
} elseif($extension -eq ".tfvars") {
44+
} elseif ($extension -eq ".tfvars") {
4545
try {
4646
$config = [PSCustomObject](& $hclParserToolPath $configFilePath | ConvertFrom-Json)
4747
} catch {
@@ -55,12 +55,12 @@ function Get-ALZConfig {
5555

5656
Write-Verbose "Config file loaded from $configFilePath with $($config.PSObject.Properties.Name.Count) properties."
5757

58-
foreach($property in $config.PSObject.Properties) {
58+
foreach ($property in $config.PSObject.Properties) {
5959
$inputConfig | Add-Member -NotePropertyName $property.Name -NotePropertyValue @{
6060
Value = $property.Value
6161
Source = $extension
6262
}
6363
}
6464

6565
return $inputConfig
66-
}
66+
}

src/ALZ/Private/Config-Helpers/Get-AvailabilityZonesSupport.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ function Get-AvailabilityZonesSupport {
1212
$jsonZones = ConvertTo-Json $zone.zones -Depth 10
1313
Write-Verbose "Zones for $region are $jsonZones"
1414
return $zone.zones
15-
}
15+
}

src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,38 @@ function Get-AzureRegionData {
55
)
66

77
$terraformCode = @'
8-
terraform {
9-
required_providers {
10-
azapi = {
11-
source = "azure/azapi"
12-
version = "~> 2.0"
8+
terraform {
9+
required_providers {
10+
azapi = {
11+
source = "azure/azapi"
12+
version = "~> 2.0"
13+
}
14+
}
1315
}
14-
}
15-
}
1616
17-
module "regions" {
18-
source = "Azure/avm-utl-regions/azurerm"
19-
version = "0.3.0"
20-
use_cached_data = false
21-
availability_zones_filter = false
22-
recommended_filter = false
23-
}
17+
module "regions" {
18+
source = "Azure/avm-utl-regions/azurerm"
19+
version = "0.3.0"
20+
use_cached_data = false
21+
availability_zones_filter = false
22+
recommended_filter = false
23+
}
2424
25-
locals {
26-
regions = { for region in module.regions.regions_by_name : region.name => {
27-
display_name = region.display_name
28-
zones = region.zones == null ? [] : [for zone in region.zones : tostring(zone)]
25+
locals {
26+
regions = { for region in module.regions.regions_by_name : region.name => {
27+
display_name = region.display_name
28+
zones = region.zones == null ? [] : [for zone in region.zones : tostring(zone)]
29+
}
30+
}
2931
}
30-
}
31-
}
3232
33-
output "regions_and_zones" {
34-
value = local.regions
35-
}
33+
output "regions_and_zones" {
34+
value = local.regions
35+
}
3636
'@
3737

3838
$regionFolder = Join-Path $toolsPath "azure-regions"
39-
if(Test-Path $regionFolder) {
39+
if (Test-Path $regionFolder) {
4040
Remove-Item $regionFolder -Recurse -Force
4141
}
4242

@@ -55,7 +55,7 @@ output "regions_and_zones" {
5555
$zonesSupport = @()
5656
$supportedRegions = @()
5757

58-
foreach($region in $regionsAndZones.PSObject.Properties) {
58+
foreach ($region in $regionsAndZones.PSObject.Properties) {
5959
$supportedRegions += $region.Name
6060
$zonesSupport += @{
6161
region = $region.Name
@@ -67,4 +67,4 @@ output "regions_and_zones" {
6767
zonesSupport = $zonesSupport
6868
supportedRegions = $supportedRegions
6969
}
70-
}
70+
}

0 commit comments

Comments
 (0)