Skip to content

Commit ea20db6

Browse files
authored
actions: add missing actions output for terraform apply cli (#37692)
1 parent 04c95fe commit ea20db6

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
kind: BUGFIX
2+
body: The CLI now summarizes the number of actions invoked during `terraform apply`, matching the plan output.
3+
time: 2025-09-27T18:41:34.771437+02:00
4+
custom:
5+
Issue: "37689"

internal/command/views/apply.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,26 @@ type ApplyHuman struct {
6161
var _ Apply = (*ApplyHuman)(nil)
6262

6363
func (v *ApplyHuman) ResourceCount(stateOutPath string) {
64+
var summary string
6465
if v.destroy {
65-
v.view.streams.Printf(
66-
v.view.colorize.Color("[reset][bold][green]\nDestroy complete! Resources: %d destroyed.\n"),
67-
v.countHook.Removed,
68-
)
66+
summary = fmt.Sprintf("Destroy complete! Resources: %d destroyed.", v.countHook.Removed)
6967
} else if v.countHook.Imported > 0 {
70-
v.view.streams.Printf(
71-
v.view.colorize.Color("[reset][bold][green]\nApply complete! Resources: %d imported, %d added, %d changed, %d destroyed.\n"),
68+
summary = fmt.Sprintf("Apply complete! Resources: %d imported, %d added, %d changed, %d destroyed.",
7269
v.countHook.Imported,
7370
v.countHook.Added,
7471
v.countHook.Changed,
75-
v.countHook.Removed,
76-
)
72+
v.countHook.Removed)
7773
} else {
78-
v.view.streams.Printf(
79-
v.view.colorize.Color("[reset][bold][green]\nApply complete! Resources: %d added, %d changed, %d destroyed.\n"),
74+
summary = fmt.Sprintf("Apply complete! Resources: %d added, %d changed, %d destroyed.",
8075
v.countHook.Added,
8176
v.countHook.Changed,
82-
v.countHook.Removed,
83-
)
77+
v.countHook.Removed)
8478
}
79+
v.view.streams.Print(v.view.colorize.Color("[reset][bold][green]\n" + summary))
80+
if v.countHook.ActionInvocation > 0 {
81+
v.view.streams.Print(v.view.colorize.Color(fmt.Sprintf("[reset][bold][green] Actions: %d invoked.", v.countHook.ActionInvocation)))
82+
}
83+
v.view.streams.Print("\n")
8584
if (v.countHook.Added > 0 || v.countHook.Changed > 0) && stateOutPath != "" {
8685
v.view.streams.Printf("\n%s\n\n", format.WordWrap(stateOutPathPostApply, v.view.outputColumns()))
8786
v.view.streams.Printf("State path: %s\n", stateOutPath)

0 commit comments

Comments
 (0)