From eb7b5da1be63b54b9ccfcaea9a611bc9cde95871 Mon Sep 17 00:00:00 2001 From: Jocelyn Giroux Date: Tue, 3 Dec 2024 07:13:14 -0500 Subject: [PATCH 1/2] Add a new status when there is no change in the plan --- configstack/stack_plan.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/configstack/stack_plan.go b/configstack/stack_plan.go index 9288bea46..846c27493 100644 --- a/configstack/stack_plan.go +++ b/configstack/stack_plan.go @@ -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{ + "No changes. Infrastructure is up-to-date.", + "Plan: 0 to add, 0 to change, 0 to destroy.", + "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) From a9cc9730b0c7573285a1462d10a73cf720a6b752 Mon Sep 17 00:00:00 2001 From: Jocelyn Giroux Date: Tue, 3 Dec 2024 08:17:28 -0500 Subject: [PATCH 2/2] Add comments following review --- configstack/stack_plan.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configstack/stack_plan.go b/configstack/stack_plan.go index 846c27493..5f2ca3142 100644 --- a/configstack/stack_plan.go +++ b/configstack/stack_plan.go @@ -152,8 +152,8 @@ func warnAboutMissingDependencies(module TerraformModule, output string) { // Parse the output message to extract a summary func extractSummaryResultFromPlan(output string) planSummary { noChanges := []string{ - "No changes. Infrastructure is up-to-date.", - "Plan: 0 to add, 0 to change, 0 to destroy.", + "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.", }