Skip to content

Commit

Permalink
Merge pull request #85 from hashicorp/f-disco-win-executable
Browse files Browse the repository at this point in the history
terraform/discovery: Find exe on Windows explicitly
  • Loading branch information
radeksimko authored May 6, 2020
2 parents 80c5aaa + cfac419 commit bdf05df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/terraform/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ type DiscoveryFunc func() (string, error)
type Discovery struct{}

func (d *Discovery) LookPath() (string, error) {
path, err := exec.LookPath("terraform")
path, err := exec.LookPath(executableName)
if err != nil {
return "", fmt.Errorf("unable to find terraform: %s", err)
return "", fmt.Errorf("unable to find %s: %s", executableName, err)
}
return path, nil
}
5 changes: 5 additions & 0 deletions internal/terraform/discovery/discovery_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// +build !windows

package discovery

const executableName = "terraform"
3 changes: 3 additions & 0 deletions internal/terraform/discovery/discovery_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package discovery

const executableName = "terraform.exe"

0 comments on commit bdf05df

Please sign in to comment.