hashicorp / hashicorp/setup-terraform

wrapper fails with obscure error message if `terraform validate` is killed

Open
#276 10 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.6k
Forks
288
Avg merge
23h 21m
Merged PRs (30d)
3

Description

Our GitHub Action performing `terraform validate` fails with an obscure error message on a commit it previously validated successfully:

Run terraform validate -no-color
/home/runner/work/_temp/12cb240b-5a9f-44d7-9df4-0c2e0c97750d/terraform-bin validate -no-color
/home/runner/work/_temp/12cb240b-5a9f-44d7-9df4-0c2e0c97750d/terraform:4211
core.setOutput('exitcode', exitCode.toString(10));
^

TypeError: Cannot read properties of null (reading 'toString')
at /home/runner/work/_temp/12cb240b-5a9f-44d7-9df4-0c2e0c97750d/terraform:4211:39
Error: Process completed with exit code 1.

Here is our `.github/workflows/terraform_pr.yml`:

name: Terraform PR Check

on: [pull_request]

jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: HashiCorp - Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.4

- name: Terraform fmt
id: fmt
run: terraform fmt -check -recursive

- name: Terraform Init
id: init
run: terraform init -backend=false

- name: Terraform Validate
id: validate
run: terraform validate -no-color

Disabling the wrapper script with

uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.4
terraform_wrapper: false

and re-running the job led to this error message:

Run terraform validate -no-color
/home/runner/work/_temp/0bb3bce2-0453-4b29-9ccb-19976a647ace.sh: line 1: 1683 Killed terraform validate -no-color
Error: Process completed with exit code 137.

Therefore, I believe the error message presented above is caused by `terraform` being killed.
Is it possible to detect this and improve the error message?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.