Skip to content

Commit 4369f90

Browse files
authored
Chore: print schema output error when we get it (#203)
* Chore: print schema output error when we get it * add standard output
1 parent c131667 commit 4369f90

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.github/workflows/release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Run GoReleaser
2121
uses: goreleaser/goreleaser-action@v5
2222
with:
23-
version: latest
23+
version: ~> v1
2424
args: release --clean
2525
env:
2626
CGO_ENABLED: 0
@@ -48,9 +48,9 @@ jobs:
4848
CGO_ENABLED=0 go build -ldflags "-X main.version=${{github.ref_name}}" -a -installsuffix cgo -o ./out/terratag/terratag ./cmd/terratag
4949
# Setup .npmrc file to publish to GitHub Packages
5050
- name: Setup Node
51-
uses: actions/setup-node@v3
51+
uses: actions/setup-node@v4
5252
with:
53-
node-version: "12.x"
53+
node-version: 20
5454
registry-url: "https://registry.npmjs.org"
5555
scope: "@env0"
5656
- run: |

internal/tfschema/tfschema.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,18 @@ func getResourceSchema(resourceType string, resource hclwrite.Block, dir string,
174174

175175
out, err := cmd.Output()
176176
if err != nil {
177-
return nil, fmt.Errorf("failed to execute '%s providers schema -json' command: %w", name, err)
177+
var ee *exec.ExitError
178+
if errors.As(err, &ee) && ee.Stderr != nil {
179+
log.Println("===============================================")
180+
log.Printf("Error output: %s\n", string(ee.Stderr))
181+
log.Println("===============================================")
182+
}
183+
184+
log.Println("===============================================")
185+
log.Printf("Standard output: %s\n", string(out))
186+
log.Println("===============================================")
187+
188+
return nil, fmt.Errorf("failed to execute '%s providers schema -json' command in directory '%s': %w", name, dir, err)
178189
}
179190

180191
// Output can vary between operating systems. Get the correct output line.

0 commit comments

Comments
 (0)