Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/terraform/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func extractMovedResource(pattern *regexp.Regexp, line string) *MovedResource {
}

// Parse returns ParseResult related with terraform plan
func (p *PlanParser) Parse(body string) ParseResult { //nolint:cyclop
func (p *PlanParser) Parse(body string) ParseResult { //nolint:cyclop,maintidx
switch {
case p.Fail.MatchString(body):
case p.Pass.MatchString(body) || p.OutputsChanges.MatchString(body):
Expand All @@ -128,13 +128,13 @@ func (p *PlanParser) Parse(body string) ParseResult { //nolint:cyclop
endWarning := -1
startErrorIndex := -1
for i, line := range lines {
if line == "Note: Objects have changed outside of Terraform" { // https://github.com/hashicorp/terraform/blob/332045a4e4b1d256c45f98aac74e31102ace7af7/internal/command/views/plan.go#L403
if line == "Note: Objects have changed outside of Terraform" || line == "Note: Objects have changed outside of OpenTofu" { // https://github.com/hashicorp/terraform/blob/332045a4e4b1d256c45f98aac74e31102ace7af7/internal/command/views/plan.go#L403
startOutsideTerraform = i + 1
}
if startOutsideTerraform != -1 && endOutsideTerraform == -1 && strings.HasPrefix(line, "Unless you have made equivalent changes to your configuration") { // https://github.com/hashicorp/terraform/blob/332045a4e4b1d256c45f98aac74e31102ace7af7/internal/command/views/plan.go#L110
endOutsideTerraform = i + 1
}
if line == "Terraform will perform the following actions:" { // https://github.com/hashicorp/terraform/blob/332045a4e4b1d256c45f98aac74e31102ace7af7/internal/command/views/plan.go#L252
if line == "Terraform will perform the following actions:" || line == "OpenTofu will perform the following actions:" { // https://github.com/hashicorp/terraform/blob/332045a4e4b1d256c45f98aac74e31102ace7af7/internal/command/views/plan.go#L252
startChangeOutput = i + 1
}
// If we have output changes but not resource changes, Terraform
Expand Down