Skip to content

Commit 8b08653

Browse files
authored
Improve error logging for commands (#30)
* Improve error logging for commands * fix tf install in action
1 parent 5b45fe0 commit 8b08653

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
go-version: 1.21
1616
- name: Install licenser
1717
run: 'go install github.com/liamawhite/[email protected]'
18+
- uses: hashicorp/setup-terraform@v3
19+
with:
20+
terraform_version: "1.10.4"
1821
- name: Verify licenses and docs
1922
run: make check
2023

pkg/provider/resource_local_command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func (r *LocalCommandResource) RunCommand(ctx context.Context, data *LocalComman
254254
}
255255
err = cmd.Wait()
256256
if err != nil {
257-
tflog.Warn(ctx, fmt.Sprintf("ATTEMPT #%d exit_code=%d", attempt, err.(*exec.ExitError).ExitCode()))
257+
tflog.Warn(ctx, fmt.Sprintf("ATTEMPT #%d exit_code=%d err=%s", attempt, err.(*exec.ExitError).ExitCode(), err.Error()))
258258
data.Stdout = types.StringValue(stdout.String())
259259
data.Stderr = types.StringValue(stderr.String())
260260
tflog.Warn(ctx, fmt.Sprintf("Command string: sh -c %s", data.Command.ValueString()))

0 commit comments

Comments
 (0)