-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Is there an existing issue for this?
- I have searched the existing issues
Infrastructure as Code Type? (Required)
terraform
PowerShell Module Version (Optional)
No response
Bootstrap Module Version (Optional)
No response
Starter Module? (Required)
terraform - platform_landing_zone
Starter Module Version (Optional)
No response
Input arguments of the ALZ-PowerShell-Module (Optional)
No response
Debug Output/Panic Output (Optional)
Expected Behaviour (Required)
In the accelerator, I corrected the following in the script "Get-TerraformTool.ps1":
In this script, starting at line 42, the downloaded ZIP file containing the terraform.exe file is extracted, and then the PATH variable is set depending on the OS (Windows or Linux). However, the variable '$os' used for this is only set in line 53 via the function "Get-OSArchitecture". This causes the PATH variable to be extended with the same format as for Linux, i.e., with the ":" character, even for Windows. As a result, when running terraform.exe, the location cannot be found.
I simply copied the command line "$osArchitecture = Get-OSArchitecture" to before the unzip step, i.e., to line 42...
I also noticed the same error in the YAML file 'terraform-installer.yaml' of the CI pipeline templates
$unzipdir = Join-Path -Path $TOOLS_PATH -ChildPath "terraform_$TF_VERSION"
if (Test-Path $unzipdir) {
Write-Host "Terraform $TF_VERSION already installed."
if($os -eq "windows") {
$env:PATH = "$($unzipdir);$env:PATH"
} else {
$env:PATH = "$($unzipdir):$env:PATH"
}
Write-Host "##vso[task.setvariable variable=PATH]$env:PATH"
return
}
$os = ""
if ($IsWindows) {
$os = "windows"
}
if($IsLinux) {
$os = "linux"
}
if($IsMacOS) {
$os = "darwin"
}
Here too, the '$os' variable is accessed, even though it has not been initialized yet."
Actual Behaviour (Required)
the '$os' variable is accessed, even though it has not been initialized yet."
Steps to Reproduce (Optional)
No response
Important Factoids (Optional)
No response
References (Optional)
No response