Skip to content

Commit

Permalink
Output run-all plan errors
Browse files Browse the repository at this point in the history
By using a [`io.MultiWriter`](https://golang.org/pkg/io/#MultiWriter) terraform errors and hook output is printed/output to stdErr.
This makes debugging of a hook and terraform easier because errors are no longer swallowed.
It also makes `terragrunt run-all plan` act the same in regards to output as `terragrunt plan`.
  • Loading branch information
boekkooi-fresh committed Mar 24, 2021
1 parent 7372614 commit 37f7ae3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion configstack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package configstack
import (
"bytes"
"fmt"
"io"
"sort"
"strings"

Expand Down Expand Up @@ -61,7 +62,7 @@ func (stack *Stack) Run(terragruntOptions *options.TerragruntOptions) error {
// We capture the out stream for each module
errorStreams := make([]bytes.Buffer, len(stack.Modules))
for n, module := range stack.Modules {
module.TerragruntOptions.ErrWriter = &errorStreams[n]
module.TerragruntOptions.ErrWriter = io.MultiWriter(module.TerragruntOptions.ErrWriter, &errorStreams[n])
}
defer stack.summarizePlanAllErrors(terragruntOptions, errorStreams)
}
Expand Down

0 comments on commit 37f7ae3

Please sign in to comment.