Skip to content

Commit

Permalink
fix counting for modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
djelusic committed Nov 11, 2021
1 parent 907cc2f commit 7ba6035
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/ui/progress/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func (p *Terraform) Parse(line string) {
if ok := p.parser.Parse(line); !ok {
return
}
p.checkState(oldState)
p.updateCounter()
p.checkState(oldState)
}

func (p *Terraform) checkState(oldState terraform.ParserState) {
Expand Down
4 changes: 3 additions & 1 deletion node/terraform/log_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var (
destroyedRegExp = regexp.MustCompile(`TF: \w*\.\w*\.(\w*)\.(\w*)\[*\"*([\$\w/]*)"*\]*: Destruction complete after (\w*)`)
destroyedRegExpSubModule = regexp.MustCompile(`TF: \w*\.\w*\.\w*\..*\.(\w*)\.(\w*)\[*\"*([\$\w/]*)"*\]*: Destruction complete after (\w*)`)
modifiedRegExp = regexp.MustCompile(`TF: \w*\.\w*\.(\w*)\.(\w*)\[*\"*([\$\w/]*)"*\]*: Modifications complete after (\w*)`)
modifiedRegExpSubModule = regexp.MustCompile(`TF: \w*\.\w*\.\w*\..*\.(\w*)\.(\w*)\[*\"*([\$\w/]*)"*\]*: Modifications complete after (\w*)`)
completeRegExp = regexp.MustCompile(`TF: Apply complete! Resources: (\w*) added, (\w*) changed, (\w*) destroyed.`)
planRegExp = regexp.MustCompile(`TF: Plan: (\w*) to add, (\w*) to change, (\w*) to destroy.`)
outputRegExp = regexp.MustCompile(`TFO: (\w*) = "(.*)"`)
Expand Down Expand Up @@ -112,7 +113,8 @@ func (p *Parser) Parse(line string) bool {
createdRegExpSubModule.MatchString(line) ||
destroyedRegExp.MatchString(line) ||
destroyedRegExpSubModule.MatchString(line) ||
modifiedRegExp.MatchString(line) {
modifiedRegExp.MatchString(line) ||
modifiedRegExpSubModule.MatchString(line) {
p.counter.inc()
return true
}
Expand Down

0 comments on commit 7ba6035

Please sign in to comment.