Skip to content

Commit

Permalink
Add additional logging on 'state pull' failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ljfranklin committed May 9, 2020
1 parent ea9cff6 commit c97c272
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/terraform-resource/terraform/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,11 @@ func (c *client) StatePull(envName string) ([]byte, error) {

rawOutput, err := cmd.Output()
if err != nil {
return nil, fmt.Errorf("Error running `state pull`: %s, Output: %s", err, rawOutput)
errOutput := rawOutput
if exitErr, ok := err.(*exec.ExitError); ok {
errOutput = exitErr.Stderr
}
return nil, fmt.Errorf("Error running `state pull`: %s, Output: %s", err, errOutput)
}

return rawOutput, nil
Expand Down

0 comments on commit c97c272

Please sign in to comment.