Skip to content

Hook execution error message is confusing #5596

@GergelyKalmar

Description

@GergelyKalmar

Error Message Details

The Error Message

11:01:28.886 INFO   Executing hook: tflint
1 issue(s) found:

Warning: Module should include an empty variables.tf file (terraform_standard_module_structure)

  on variables.tf line 1:
   (source code not available)

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.13.0/docs/rules/terraform_standard_module_structure.md

11:01:28.949 ERROR  Error running hook tflint with message: Failed to execute "/usr/local/bin/tflint --color --config ./.tflint.hcl --chdir ." in .

exit status 2
11:01:28.949 ERROR  error occurred:

* Failed to execute "/usr/local/bin/tflint --color --config ./.tflint.hcl --chdir ." in .

  exit status 2

Why This Error Message is Unhelpful

Current Problems

The current hook execution error message suggests that there was a problem with the execution (e.g. Terragrunt could not find the binary to call) even in cases where the execution of a hook was successful. In some cases (e.g. when calling out to an external TFLint binary directly for linting) this can be confusing to users.

Recommended Improvement

What the Error Message Should Say

11:01:28.949 ERROR  The "tflint" hook encountered a non-zero exit status (execution of "/usr/local/bin/tflint --color --config ./.tflint.hcl --chdir ." in "." resulted in status 2)

Error Reproduction Steps

An example hook would be as follows:

  after_hook "tflint" {
    commands = ["validate"]
    execute = ["/usr/local/bin/tflint", "--color", "--config", ".tflint.json"]
  }

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingerror-messageRelates to an error message in Terragrunt.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions