Closed Starefossen closed 4 years ago
We are currently facing the same issue. @Starefossen were you able to resolve the issue?
the issue is in tee.go
the issue is that tfnotify scans by line and s.Scan()
panics when the line is too long
Scan panics if the split function returns too many empty tokens without advancing the input. This is a common error mode for scanners.
This is a fixed version that scans by byte.
package main
import (
"bufio"
"bytes"
"io"
"github.com/mattn/go-colorable"
)
func tee(stdin io.Reader, stdout io.Writer) string {
var b1 bytes.Buffer
var b2 bytes.Buffer
tee := io.TeeReader(stdin, &b1)
s := bufio.NewScanner(tee)
s.Split(bufio.ScanBytes)
for s.Scan() {
stdout.Write(s.Bytes())
}
uncolorize := colorable.NewNonColorable(&b2)
uncolorize.Write(b1.Bytes())
return b2.String()
}
WHAT
We have a very long Terraform Plan output with a lot of inline JSON that cuauses the following error:
From the looks of it
tfnotify
just gives up half way through and can not find what it is looking for in order to classify this as a valid plan.As you can see the plan is quit big, this would definitly hit the GitHub comment limit #34, but this should still not fail in
tfnotify
, don't you think?This is the latest version of tfnotify and the latest v0.11 version of Terraform.