Skip to content

Commit f55f012

Browse files
fix: make the result errors even if outputs will be changed (#909)
1 parent bdc9022 commit f55f012

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/terraform/parser.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ func (p *PlanParser) Parse(body string) ParseResult { //nolint:cyclop
120120
endChangeOutput := -1
121121
startWarning := -1
122122
endWarning := -1
123+
startErrorIndex := -1
123124
for i, line := range lines {
124125
if line == "Note: Objects have changed outside of Terraform" { // https://github.com/hashicorp/terraform/blob/332045a4e4b1d256c45f98aac74e31102ace7af7/internal/command/views/plan.go#L403
125126
startOutsideTerraform = i + 1
@@ -147,8 +148,15 @@ func (p *PlanParser) Parse(body string) ParseResult { //nolint:cyclop
147148
endChangeOutput = i - 1
148149
}
149150
}
151+
if startErrorIndex == -1 {
152+
if p.Fail.MatchString(line) {
153+
startErrorIndex = i
154+
firstMatchLineIndex = i
155+
firstMatchLine = line
156+
}
157+
}
150158
if firstMatchLineIndex == -1 {
151-
if p.Pass.MatchString(line) || p.Fail.MatchString(line) || p.OutputsChanges.MatchString(line) {
159+
if p.Pass.MatchString(line) || p.OutputsChanges.MatchString(line) {
152160
firstMatchLineIndex = i
153161
firstMatchLine = line
154162
}

0 commit comments

Comments
 (0)