Backport of Added missing output for the terraform apply cli actions into v1.14 (#37718)

* backport of commit f13a3ae8d8

---------

Co-authored-by: Akella Umesh <umesh.akella@gmail.com>
Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
pull/37728/head
github-actions[bot] 7 months ago committed by GitHub
parent d3a898b327
commit 3c267ecfc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
kind: BUGFIX
body: The CLI now summarizes the number of actions invoked during `terraform apply`, matching the plan output.
time: 2025-09-27T18:41:34.771437+02:00
custom:
Issue: "37689"

@ -61,27 +61,27 @@ type ApplyHuman struct {
var _ Apply = (*ApplyHuman)(nil)
func (v *ApplyHuman) ResourceCount(stateOutPath string) {
var summary string
if v.destroy {
v.view.streams.Printf(
v.view.colorize.Color("[reset][bold][green]\nDestroy complete! Resources: %d destroyed.\n"),
v.countHook.Removed,
)
summary = fmt.Sprintf("Destroy complete! Resources: %d destroyed.", v.countHook.Removed)
} else if v.countHook.Imported > 0 {
v.view.streams.Printf(
v.view.colorize.Color("[reset][bold][green]\nApply complete! Resources: %d imported, %d added, %d changed, %d destroyed.\n"),
summary = fmt.Sprintf("Apply complete! Resources: %d imported, %d added, %d changed, %d destroyed.",
v.countHook.Imported,
v.countHook.Added,
v.countHook.Changed,
v.countHook.Removed,
)
v.countHook.Removed)
} else {
v.view.streams.Printf(
v.view.colorize.Color("[reset][bold][green]\nApply complete! Resources: %d added, %d changed, %d destroyed.\n"),
summary = fmt.Sprintf("Apply complete! Resources: %d added, %d changed, %d destroyed.",
v.countHook.Added,
v.countHook.Changed,
v.countHook.Removed,
)
v.countHook.Removed)
}
v.view.streams.Print(v.view.colorize.Color("[reset][bold][green]\n" + summary))
if v.countHook.ActionInvocation > 0 {
actionsStr := fmt.Sprintf("[reset][bold][green] Actions: %d invoked.", v.countHook.ActionInvocation)
v.view.streams.Print(v.view.colorize.Color(actionsStr))
}
v.view.streams.Print("\n")
if (v.countHook.Added > 0 || v.countHook.Changed > 0) && stateOutPath != "" {
v.view.streams.Printf("\n%s\n\n", format.WordWrap(stateOutPathPostApply, v.view.outputColumns()))
v.view.streams.Printf("State path: %s\n", stateOutPath)

Loading…
Cancel
Save