Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for env defined binary #68

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion parser/binary-parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package parser
import (
"encoding/json"
"fmt"
"os"
"os/exec"

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

func (j BinaryParser) Parse() (tfjson.Plan, error) {
cmd := exec.Command("terraform", "show", "-json", j.fileName)
tfbinary := "terraform"
if tfoverride, ok := os.LookupEnv("TF_BINARY"); ok {
tfbinary = tfoverride
}
cmd := exec.Command(tfbinary, "show", "-json", j.fileName)
output, err := cmd.CombinedOutput()
if err != nil {
return tfjson.Plan{}, fmt.Errorf(
Expand Down
Loading