1616 The architecture of the binary to install. Defaults to amd64
1717
1818 . PARAMETER PSDependAction
19- Test or Install the module. Defaults to Install
19+ Test or Install the module. Defaults to Install
2020
2121 Test: Return true or false on whether the dependency is in place
2222 Install: Install the dependency
@@ -87,8 +87,8 @@ if (-not $Version) {
8787 throw " Input version does not match regex"
8888}
8989
90- $Platform = ((Get-OSEnvironment ) -eq " MacOS" ? " darwin" : ( Get-OSEnvironment )).ToLower()
91- $FileName = " terraform_{0}_{1}_{2}.zip" -f $Version , $Platform , $Architecture
90+ $Platform = if ((Get-OSEnvironment ) -eq " MacOS" ) { " darwin" } else { Get-OSEnvironment }
91+ $FileName = " terraform_{0}_{1}_{2}.zip" -f $Version , $Platform.ToLower () , $Architecture
9292$DownloadPath = Join-Path $env: TEMP $FileName
9393if (-not $Dependency.target ) {
9494 $Path = Get-Location
@@ -100,19 +100,19 @@ else {
100100if ($tf.IsInstalled ) {
101101 if ($tf.Version -ne $Version ) {
102102 Write-Verbose " Installed Terraform v$ ( $tf.Version ) does not match version v$ ( $Version ) required"
103- $ToInstall = $true
103+ $InstallNeeded = $true
104104 }
105105 else {
106106 Write-Verbose " Terraform v$ ( $tf.Version ) installed"
107- $ToInstall = $false
107+ $InstallNeeded = $false
108108 }
109109}
110110else {
111111 Write-Verbose " Terraform not found on path"
112- $ToInstall = $true
112+ $InstallNeeded = $true
113113}
114114
115- if ($PSDependAction -eq " Install" -and $ToInstall -eq $true ) {
115+ if ($PSDependAction -eq " Install" -and $InstallNeeded ) {
116116 if ($Source ) {
117117 $URL = $Source
118118 }
@@ -145,9 +145,9 @@ if ($PSDependAction -eq "Install" -and $ToInstall -eq $true) {
145145
146146 return $true
147147}
148- elseif ($PSDependAction -eq " Install" -and $ToInstall -eq $false ) {
148+ elseif ($PSDependAction -eq " Install" -and $InstallNeeded -eq $false ) {
149149 return $true
150150}
151151elseif ($PSDependAction -eq " Test" ) {
152- return $ToInstall -eq $true ? $false : $true
152+ return -not $InstallNeeded
153153}
0 commit comments