Skip to content

Commit

Permalink
Fix recursion
Browse files Browse the repository at this point in the history
Start from current directory
  • Loading branch information
pearcec committed Apr 16, 2021
1 parent 702d6f8 commit 5345b6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Invoke-Terraform/Private/Get-TerraformVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Function Get-TerraformVersion {
}

$Parent = Split-Path $Path
# Stop at users home directory
if ($Parent -eq $Home) {
return $null
}
if ($Parent) {
Get-TerraformVersion $Parent
} else {
return $null
return Get-TerraformVersion $Parent
}

# Shouldn't get here
return $null
}
2 changes: 1 addition & 1 deletion Invoke-Terraform/Public/Invoke-Terraform.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Function Invoke-Terraform {
$TFArgs = $args
}

$terraformVersionFile = Get-TerraformVersion -Path $PSScriptRoot
$terraformVersionFile = Get-TerraformVersion -Path (Get-Item .).FullName
if ($terraformVersionFile -and (-not $TFVersion)) {
$TFVersion = Get-Content $terraformVersionFile
# TODO regex validate the version
Expand Down

0 comments on commit 5345b6e

Please sign in to comment.