hashicorp / setup-terraform

Sets up Terraform CLI in your GitHub Actions workflow.
https://developer.hashicorp.com/terraform/tutorials/automation/github-actions
Mozilla Public License 2.0
1.34k stars 235 forks source link

Stdout is interleaved with stderr and stderr when wrapper is enabled #405

Closed justinmchase closed 2 months ago

justinmchase commented 4 months ago

When the wrapper is enabled it appears to buffer all of the stderr and stdout and once terraform exits it displays the stderr and stdout all at once.

The result is the errors tend to be shown at the start of the output rather than the end, and it can sometimes be interleaved with stdout so your errors are extremely hard to read.

Github actions will autoamtically scroll you to the bottom of a log group but the terraform stderr is displayed at the top so you have to always manually scroll all the way to the top just to see the errors.

Ideally the wrapper, would not be buffering the stdout or stderr, but just write it as it comes. And stderr should have the same chrological order that it was recieved with respect to stdout.

bflad commented 4 months ago

Hi @justinmchase 👋 Thank you for raising this issue and apologies for the frustrating behavior.

It seems you already know this, but for others, the workaround is to disable the wrapper by passing in the terraform_wrapper: false option:

- uses: hashicorp/setup-terraform@v3
  with:
    terraform_wrapper: false

While this disables the GitHub Actions outputs, it should at least prevent this particular issue.

I will forward bug report this along with the related https://github.com/hashicorp/setup-terraform/issues/395 to the responsible team, but unfortunately I do not have any particular insight when it might be prioritized and fixed. If someone is interested in submitting a fix with associated testing, that could speed up the resolution process.

justinmchase commented 4 months ago

yes indeed, very related to #395 and I'm not blocked but I just wanted to put this issue on the record as it appears to be distinct from whats reported in the other issue.

github-actions[bot] commented 1 month ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.