File tree Expand file tree Collapse file tree 2 files changed +49
-17
lines changed Expand file tree Collapse file tree 2 files changed +49
-17
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,34 @@ function Get-HCLParserTool {
20
20
$os = " darwin"
21
21
}
22
22
23
- $architecture = $ ($env: PROCESSOR_ARCHITECTURE ).ToLower()
24
- $toolFileName = " hcl2json_$ ( $os ) _$ ( $architecture ) "
23
+ # Enum values can be seen here: https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.architecture?view=net-7.0#fields
24
+ $architecture = ([System.Runtime.InteropServices.RuntimeInformation ]::OSArchitecture).ToString().ToLower()
25
+
26
+ if ($architecture -eq " x64" ) {
27
+ $architecture = " amd64"
28
+ }
29
+ if ($architecture -eq " x86" ) {
30
+ $architecture = " 386"
31
+ }
32
+
33
+ $osAndArchitecture = " $ ( $os ) _$ ( $architecture ) "
34
+
35
+ $supportedOsAndArchitectures = @ (
36
+ " darwin_amd64" ,
37
+ " darwin_arm64" ,
38
+ " linux_386" ,
39
+ " linux_amd64" ,
40
+ " linux_arm64" ,
41
+ " windows_386" ,
42
+ " windows_amd64"
43
+ )
44
+
45
+ if ($supportedOsAndArchitectures -notcontains $osAndArchitecture ) {
46
+ Write-Error " Unsupported OS and architecture combination: $osAndArchitecture "
47
+ exit 1
48
+ }
49
+
50
+ $toolFileName = " hcl2json_$osAndArchitecture "
25
51
26
52
if ($os -eq " windows" ) {
27
53
$toolFileName = " $ ( $toolFileName ) .exe"
@@ -32,6 +58,13 @@ function Get-HCLParserTool {
32
58
if (! (Test-Path $toolFilePath )) {
33
59
Invoke-WebRequest - Uri " https://github.com/tmccombs/hcl2json/releases/download/$ ( $toolVersion ) /$ ( $toolFileName ) " - OutFile " $toolFilePath " | Out-String | Write-Verbose
34
60
}
61
+
62
+ if ($os -ne " windows" ) {
63
+ $isExecutable = $ (test - x $toolFilePath ; 0 -eq $LASTEXITCODE )
64
+ if (! ($isExecutable )) {
65
+ chmod + x $toolFilePath
66
+ }
67
+ }
35
68
}
36
69
37
70
return $toolFilePath
Original file line number Diff line number Diff line change @@ -58,22 +58,21 @@ function New-ALZEnvironment {
58
58
Write-InformationColored " Getting ready to create a new ALZ environment with you..." - ForegroundColor Green - InformationAction Continue
59
59
60
60
if ($PSCmdlet.ShouldProcess (" Accelerator setup" , " modify" )) {
61
- switch ($alzIacProvider ) {
62
- " bicep" {
63
- if ($alzVersion -eq " " ) {
64
- $alzVersion = " v0.16.3"
65
- }
66
- New-ALZEnvironmentBicep - alzEnvironmentDestination $alzEnvironmentDestination - alzVersion $alzVersion - alzCicdPlatform $alzCicdPlatform
61
+ if ($alzIacProvider -eq " bicep" ) {
62
+ if ($alzVersion -eq " " ) {
63
+ $alzVersion = " v0.16.3"
67
64
}
68
- " terraform" {
69
- if ($alzVersion -eq " " ) {
70
- $alzVersion = " latest"
71
- }
72
- if ($autoApprove ) {
73
- New-ALZEnvironmentTerraform - alzEnvironmentDestination $alzEnvironmentDestination - alzVersion $alzVersion - alzCicdPlatform $alzCicdPlatform - userInputOverridePath $userInputOverridePath - autoApprove
74
- } else {
75
- New-ALZEnvironmentTerraform - alzEnvironmentDestination $alzEnvironmentDestination - alzVersion $alzVersion - alzCicdPlatform $alzCicdPlatform - userInputOverridePath $userInputOverridePath
76
- }
65
+ New-ALZEnvironmentBicep - alzEnvironmentDestination $alzEnvironmentDestination - alzVersion $alzVersion - alzCicdPlatform $alzCicdPlatform
66
+ }
67
+
68
+ if ($alzIacProvider -eq " terraform" ) {
69
+ if ($alzVersion -eq " " ) {
70
+ $alzVersion = " latest"
71
+ }
72
+ if ($autoApprove ) {
73
+ New-ALZEnvironmentTerraform - alzEnvironmentDestination $alzEnvironmentDestination - alzVersion $alzVersion - alzCicdPlatform $alzCicdPlatform - userInputOverridePath $userInputOverridePath - autoApprove
74
+ } else {
75
+ New-ALZEnvironmentTerraform - alzEnvironmentDestination $alzEnvironmentDestination - alzVersion $alzVersion - alzCicdPlatform $alzCicdPlatform - userInputOverridePath $userInputOverridePath
77
76
}
78
77
}
79
78
}
You can’t perform that action at this time.
0 commit comments