Skip to content

Commit

Permalink
improve exec with output logging (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks authored Aug 22, 2024
1 parent 513715b commit 67b4428
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/harness/tool/terraform/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (in *Terraform) state() (*tfjson.State, error) {
exec.WithDir(in.dir),
).RunWithOutput(context.Background())
if err != nil {
return state, err
return state, fmt.Errorf("failed executing terraform show -json: %s: %w", string(output), err)
}

err = state.UnmarshalJSON(output)
Expand All @@ -135,7 +135,7 @@ func (in *Terraform) plan() (string, error) {
exec.WithDir(in.dir),
).RunWithOutput(context.Background())
if err != nil {
return "", err
return "", fmt.Errorf("failed executing terraform show: %s: %w", string(output), err)
}

klog.V(log.LogLevelTrace).InfoS("terraform plan file read successfully", "file", in.planFileName, "output", string(output))
Expand Down

0 comments on commit 67b4428

Please sign in to comment.