gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
8.01k stars 971 forks source link

plan-all buffers terraform stderr #1016

Open andysworkshop opened 4 years ago

andysworkshop commented 4 years ago

The current implementation of plan-all buffers all stderr output from every terraform invocation in order to parse it for a specific error case.

This is fine for 'normal' runs but unfortunately when TF_LOG is set to debug then the provider's logging appears on stderr. This results in several problems for terragrunt:

Would anyone object to a PR that made capturing stderr conditional on TF_LOG being unset? I think it's reasonable to assume that if TF_LOG has been set then you've got developers debugging and the buffering/parsing logic isn't required.

yorinasub17 commented 4 years ago

I am not sure a feature to buffer stderr conditional on TF_LOG is the right approach here.

A better approach would be to use a goroutine to check the error stream line by line incrementally instead of buffering and checking at the end.

andysworkshop commented 4 years ago

I am not sure a feature to buffer stderr conditional on TF_LOG is the right approach here.

A better approach would be to use a goroutine to check the error stream line by line incrementally instead of buffering and checking at the end.

That could work, and would be a better approach if it does. I'll see what I can do.

duxbuse commented 1 year ago

A better approach would be to use a goroutine to check the error stream line by line incrementally instead of buffering and checking at the end.

I am also having issues where with large repositories to run it all in parallel ends up using multiple gigs of memory breaking my github actions. Which means I can't run it in parallel so it takes a long time to run.