From 8649eae35d7ccf48fba7cb3a61b01fe8679dedaf Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Tue, 8 Jul 2025 10:54:37 +0200 Subject: [PATCH] rename ActionInvocation for clarity --- internal/addrs/action.go | 6 +++--- internal/command/views/hook_json_test.go | 8 ++++---- internal/command/views/json/hook.go | 8 ++++---- internal/terraform/hook.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/addrs/action.go b/internal/addrs/action.go index 456e042e71..4ed1a55b8e 100644 --- a/internal/addrs/action.go +++ b/internal/addrs/action.go @@ -330,8 +330,8 @@ type configActionKey string func (k configActionKey) uniqueKeySigil() {} -// ActionInvocation describes the invocation of an action as part of a plan / apply. -type ActionInvocation struct { +// AbsActionInvocationInstance describes the invocation of an action as part of a plan / apply. +type AbsActionInvocationInstance struct { TriggeringResource AbsResourceInstance Action AbsActionInstance TriggerIndex int @@ -345,6 +345,6 @@ type ActionInvocation struct { ActionReferenceSourceRange *tfdiags.SourceRange } -func (a ActionInvocation) String() string { +func (a AbsActionInvocationInstance) String() string { return fmt.Sprintf("%s.%d.%s", a.TriggeringResource.String(), a.TriggerIndex, a.Action.String()) } diff --git a/internal/command/views/hook_json_test.go b/internal/command/views/hook_json_test.go index 765ad81fcc..372cdb3be6 100644 --- a/internal/command/views/hook_json_test.go +++ b/internal/command/views/hook_json_test.go @@ -30,8 +30,8 @@ func testJSONHookResourceID(addr addrs.AbsResourceInstance) terraform.HookResour } } -func testJSONHookActionID(addr addrs.ActionInvocation) terraform.HookActionIdentity { - return addrs.ActionInvocation{ +func testJSONHookActionID(addr addrs.AbsActionInvocationInstance) terraform.HookActionIdentity { + return addrs.AbsActionInvocationInstance{ TriggeringResource: addr.TriggeringResource, Action: addr.Action, TriggerIndex: addr.TriggerIndex, @@ -593,7 +593,7 @@ func TestJSONHook_actions(t *testing.T) { Name: "boop", }.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance) - invocationA := addrs.ActionInvocation{ + invocationA := addrs.AbsActionInvocationInstance{ TriggeringResource: resourceA, Action: actionA, TriggerIndex: 23, @@ -614,7 +614,7 @@ func TestJSONHook_actions(t *testing.T) { Name: "boop", }.Instance(addrs.NoKey).Absolute(subModule) - invocationB := addrs.ActionInvocation{ + invocationB := addrs.AbsActionInvocationInstance{ TriggeringResource: resourceB, Action: actionB, TriggerIndex: 0, diff --git a/internal/command/views/json/hook.go b/internal/command/views/json/hook.go index b7a7f5eab3..502ac5c8d0 100644 --- a/internal/command/views/json/hook.go +++ b/internal/command/views/json/hook.go @@ -370,7 +370,7 @@ func (h *actionStart) String() string { return fmt.Sprintf("%s.trigger[%d]: Action Started: %s", h.TriggeringResource.Addr, h.TriggerIndex, h.Action.Addr) } -func NewActionStart(addr addrs.ActionInvocation) Hook { +func NewActionStart(addr addrs.AbsActionInvocationInstance) Hook { return &actionStart{ TriggeringResource: newResourceAddr(addr.TriggeringResource), TriggerIndex: addr.TriggerIndex, @@ -395,7 +395,7 @@ func (h *actionProgress) String() string { return fmt.Sprintf("%s (%d): %s - %s", h.TriggeringResource.Addr, h.TriggerIndex, h.Action.Addr, h.Message) } -func NewActionProgress(addr addrs.ActionInvocation, message string) Hook { +func NewActionProgress(addr addrs.AbsActionInvocationInstance, message string) Hook { return &actionProgress{ TriggeringResource: newResourceAddr(addr.TriggeringResource), TriggerIndex: addr.TriggerIndex, @@ -420,7 +420,7 @@ func (h *actionComplete) String() string { return fmt.Sprintf("%s (%d): Action Complete: %s", h.TriggeringResource.Addr, h.TriggerIndex, h.Action.Addr) } -func NewActionComplete(addr addrs.ActionInvocation) Hook { +func NewActionComplete(addr addrs.AbsActionInvocationInstance) Hook { return &actionComplete{ TriggeringResource: newResourceAddr(addr.TriggeringResource), TriggerIndex: addr.TriggerIndex, @@ -445,7 +445,7 @@ func (h *actionErrored) String() string { return fmt.Sprintf("%s (%d): Action Errored: %s - %s", h.TriggeringResource.Addr, h.TriggerIndex, h.Action.Addr, h.Error) } -func NewActionErrored(addr addrs.ActionInvocation, err error) Hook { +func NewActionErrored(addr addrs.AbsActionInvocationInstance, err error) Hook { return &actionErrored{ TriggeringResource: newResourceAddr(addr.TriggeringResource), TriggerIndex: addr.TriggerIndex, diff --git a/internal/terraform/hook.go b/internal/terraform/hook.go index 4787d5864e..e1d8beabe3 100644 --- a/internal/terraform/hook.go +++ b/internal/terraform/hook.go @@ -35,7 +35,7 @@ type HookResourceIdentity struct { // HookActionIdentity is passed to Hook interface methods to fully identify // the action being performed. -type HookActionIdentity = addrs.ActionInvocation +type HookActionIdentity = addrs.AbsActionInvocationInstance // Hook is the interface that must be implemented to hook into various // parts of Terraform, allowing you to inspect or change behavior at runtime.