Skip to content

Commit

Permalink
Add a new status when there is no change in the plan (#728)
Browse files Browse the repository at this point in the history
* Add a new status when there is no change in the plan

* Add comments following review
  • Loading branch information
jocgir authored Dec 3, 2024
1 parent c07f64b commit 1ba45e6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions configstack/stack_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,16 @@ func warnAboutMissingDependencies(module TerraformModule, output string) {

// Parse the output message to extract a summary
func extractSummaryResultFromPlan(output string) planSummary {
const noChangeV012 = "No changes. Infrastructure is up-to-date."
const noChangeV013 = "Plan: 0 to add, 0 to change, 0 to destroy."
const noChangeV102 = "Your infrastructure matches the configuration."
if strings.Contains(output, noChangeV012) || strings.Contains(output, noChangeV013) || strings.Contains(output, noChangeV102) {
return planSummary{"No change", 0, true}
noChanges := []string{
"Plan: 0 to add, 0 to change, 0 to destroy.", // This was the message returned by terraform 0.11
"No changes. Infrastructure is up-to-date.", // This was the message returned by terraform 0.12
"Your infrastructure matches the configuration.",
"without changing any real infrastructure.",
}
for _, noChange := range noChanges {
if strings.Contains(output, noChange) {
return planSummary{"No change", 0, true}
}
}

result := planResultRegex.FindStringSubmatch(output)
Expand Down

0 comments on commit 1ba45e6

Please sign in to comment.