Skip to content

Commit 2c17fcc

Browse files
feat: add support for env defined binary (#68)
Co-authored-by: Lewin Chan <8480608+quotidian-ennui@users.noreply.github.com>
1 parent 29d45b2 commit 2c17fcc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

parser/binary-parser.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package parser
33
import (
44
"encoding/json"
55
"fmt"
6+
"os"
67
"os/exec"
78

89
tfjson "github.com/hashicorp/terraform-json"
@@ -13,7 +14,11 @@ type BinaryParser struct {
1314
}
1415

1516
func (j BinaryParser) Parse() (tfjson.Plan, error) {
16-
cmd := exec.Command("terraform", "show", "-json", j.fileName)
17+
tfbinary := "terraform"
18+
if tfoverride, ok := os.LookupEnv("TF_BINARY"); ok {
19+
tfbinary = tfoverride
20+
}
21+
cmd := exec.Command(tfbinary, "show", "-json", j.fileName)
1722
output, err := cmd.CombinedOutput()
1823
if err != nil {
1924
return tfjson.Plan{}, fmt.Errorf(

0 commit comments

Comments
 (0)