From 49feb6e86fd6336ee2bf43661c02c6f4703233ba Mon Sep 17 00:00:00 2001 From: Mutahhir Hayat Date: Tue, 3 Mar 2026 14:18:38 +0100 Subject: [PATCH] Update naming to ResourceActionTrigger --- internal/rpcapi/stacks.go | 2 +- internal/stacks/stackplan/planned_change.go | 2 +- internal/stacks/stackplan/planned_change_test.go | 6 +++--- .../stackruntime/internal/stackeval/planning_test.go | 9 ++++----- internal/stacks/stackruntime/plan_test.go | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/internal/rpcapi/stacks.go b/internal/rpcapi/stacks.go index 8098503454..15c1c49590 100644 --- a/internal/rpcapi/stacks.go +++ b/internal/rpcapi/stacks.go @@ -1345,7 +1345,7 @@ func actionInvocationPlanned(ai *hooks.ActionInvocation) (*stacks.StackChangePro } switch trig := ai.Trigger.(type) { - case *plans.LifecycleActionTrigger: + case *plans.ResourceActionTrigger: res.ActionTrigger = &stacks.StackChangeProgress_ActionInvocationPlanned_LifecycleActionTrigger{ LifecycleActionTrigger: &stacks.StackChangeProgress_LifecycleActionTrigger{ TriggeringResourceAddress: stacks.NewResourceInstanceInStackAddr( diff --git a/internal/stacks/stackplan/planned_change.go b/internal/stacks/stackplan/planned_change.go index 1332076077..b416d50b19 100644 --- a/internal/stacks/stackplan/planned_change.go +++ b/internal/stacks/stackplan/planned_change.go @@ -927,7 +927,7 @@ func (pc *PlannedChangeActionInvocationInstancePlanned) ChangeDescription() (*st // Convert the action trigger information switch at := pc.Invocation.ActionTrigger.(type) { - case *plans.LifecycleActionTrigger: + case *plans.ResourceActionTrigger: triggerEvent := stacks.PlannedChange_INVALID_EVENT switch at.ActionTriggerEvent { case configs.BeforeCreate: diff --git a/internal/stacks/stackplan/planned_change_test.go b/internal/stacks/stackplan/planned_change_test.go index 172500a0d2..78607f1427 100644 --- a/internal/stacks/stackplan/planned_change_test.go +++ b/internal/stacks/stackplan/planned_change_test.go @@ -964,7 +964,7 @@ func TestPlannedChangeAsProto(t *testing.T) { Key: addrs.NoKey, }, }, - ActionTrigger: &plans.LifecycleActionTrigger{ + ActionTrigger: &plans.ResourceActionTrigger{ TriggeringResourceAddr: addrs.Resource{ Mode: addrs.ManagedResourceMode, Type: "example_resource", @@ -993,8 +993,8 @@ func TestPlannedChangeAsProto(t *testing.T) { Invocation: &planproto.ActionInvocationInstance{ Addr: "action.webhook.notify", Provider: `provider["example.com/webhooks/http"]`, - ActionTrigger: &planproto.ActionInvocationInstance_LifecycleActionTrigger{ - LifecycleActionTrigger: &planproto.LifecycleActionTrigger{ + ActionTrigger: &planproto.ActionInvocationInstance_ResourceActionTrigger{ + ResourceActionTrigger: &planproto.ResourceActionTrigger{ TriggeringResourceAddr: "example_resource.main", TriggerEvent: planproto.ActionTriggerEvent_AFTER_CREATE, ActionTriggerBlockIndex: 0, diff --git a/internal/stacks/stackruntime/internal/stackeval/planning_test.go b/internal/stacks/stackruntime/internal/stackeval/planning_test.go index c05d290546..12e0f8b798 100644 --- a/internal/stacks/stackruntime/internal/stackeval/planning_test.go +++ b/internal/stacks/stackruntime/internal/stackeval/planning_test.go @@ -968,7 +968,6 @@ func TestPlanning_LocalsDataSource(t *testing.T) { assertNoDiagnostics(t, diags) return rawPlan, nil }) - if err != nil { t.Fatal(err) } @@ -1013,7 +1012,8 @@ func TestPlanning_LocalsDataSource(t *testing.T) { expectedString := cty.StringVal("through-local-aloha-foo-foo") expectedList := []cty.Value{ cty.StringVal("through-local-aloha-foo"), - cty.StringVal("foo")} + cty.StringVal("foo"), + } expectedMap := map[string]cty.Value{ "key": cty.StringVal("through-local-aloha-foo"), @@ -1040,7 +1040,6 @@ func TestPlanning_LocalsDataSource(t *testing.T) { return state, nil }) - if err != nil { t.Fatal(err) } @@ -1173,8 +1172,8 @@ func TestPlanning_ActionInvocationLifecycle(t *testing.T) { if foundActionChange.Invocation == nil { t.Fatal("invocation is nil") } - if _, ok := foundActionChange.Invocation.ActionTrigger.(*plans.LifecycleActionTrigger); !ok { - t.Errorf("wrong action trigger type\ngot: %T\nwant: *plans.LifecycleActionTrigger", foundActionChange.Invocation.ActionTrigger) + if _, ok := foundActionChange.Invocation.ActionTrigger.(*plans.ResourceActionTrigger); !ok { + t.Errorf("wrong action trigger type\ngot: %T\nwant: *plans.ResourceActionTrigger", foundActionChange.Invocation.ActionTrigger) } // Verify we can convert to proto successfully diff --git a/internal/stacks/stackruntime/plan_test.go b/internal/stacks/stackruntime/plan_test.go index 82e46426a5..38e0802fff 100644 --- a/internal/stacks/stackruntime/plan_test.go +++ b/internal/stacks/stackruntime/plan_test.go @@ -6460,7 +6460,7 @@ func TestPlanWithActionInvocationHooks(t *testing.T) { { Addr: testActionInvocationAddr, ProviderAddr: addrs.NewBuiltInProvider("testing"), - Trigger: &plans.LifecycleActionTrigger{ + Trigger: &plans.ResourceActionTrigger{ TriggeringResourceAddr: testResourceInstance, ActionTriggerEvent: configs.AfterCreate, ActionTriggerBlockIndex: 0,