@@ -84,7 +84,25 @@ func Apply(approve bool, vars []string, varFiles []string, lock bool, dir string
8484 Buffer : & outputBuffer ,
8585 Writer : os .Stdout ,
8686 }
87- customWriter .Write ([]byte (planDetail ))
87+
88+ // NEW: Colorize the "No changes" message if present
89+ planStr := string (planDetail )
90+ if strings .Contains (planStr , "No changes." ) {
91+ // Find and colorize the "No changes" section
92+ lines := strings .Split (planStr , "\n " )
93+ for i , line := range lines {
94+ if strings .Contains (line , "No changes." ) ||
95+ strings .Contains (line , "Your infrastructure matches the configuration" ) ||
96+ strings .Contains (line , "found no differences" ) ||
97+ strings .Contains (line , "so no changes are needed" ) {
98+ // Colorize these lines in green (like Terraform CLI does)
99+ lines [i ] = fmt .Sprintf ("\033 [32m%s\033 [0m" , line )
100+ }
101+ }
102+ planStr = strings .Join (lines , "\n " )
103+ }
104+
105+ customWriter .Write ([]byte (planStr ))
88106
89107 show , err := tf .ShowPlanFile (context .Background (), "plan.out" )
90108 if err != nil {
@@ -93,6 +111,7 @@ func Apply(approve bool, vars []string, varFiles []string, lock bool, dir string
93111 }
94112
95113 if len (show .ResourceChanges ) == 0 {
114+ // Also colorize the warning message when no changes are found
96115 Warn ("No changes to apply. Everything is up to date." )
97116 return nil
98117 }
@@ -157,7 +176,7 @@ func Apply(approve bool, vars []string, varFiles []string, lock bool, dir string
157176 }
158177 }
159178
160- Success ("Apply complete! Resources: %d added, %d changed, %d destroyed" , added , changed , destroyed )
179+ // Success("Apply complete! Resources: %d added, %d changed, %d destroyed", added, changed, destroyed)
161180 return nil
162181}
163182
0 commit comments