Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
755e612
Add Action Invocation information to Stacks Protobuf
mutahhir Oct 10, 2025
f241e72
Generate code from protobuf definition
mutahhir Oct 10, 2025
b53aee4
Fix typo in ActionTriggerEvent
mutahhir Oct 10, 2025
80b270d
Allow requesting action schema from plan producer
mutahhir Oct 10, 2025
c907523
First pass at including action invocations within stacks proto
mutahhir Oct 10, 2025
df9454b
Populate ActionTrigger
mutahhir Oct 10, 2025
87911e2
Fix bug with getting schema
mutahhir Oct 13, 2025
11805bb
Start sending change event for action invocation planning
mutahhir Oct 13, 2025
23f96bd
Include action schema in dependencies provider
mutahhir Oct 17, 2025
382e8c6
Add action type to action instance for schema lookup
mutahhir Oct 17, 2025
56690c5
Send over action type in planned change
mutahhir Oct 17, 2025
236f734
update field name to ActionTypes after rename
mutahhir Oct 17, 2025
3afe760
Fix action type to send the type and not the name
mutahhir Oct 17, 2025
8a77b19
Add deferred actions support in stacks proto
mutahhir Oct 22, 2025
200e97c
Add Deferred Action Invocation to tfstackdata
mutahhir Oct 23, 2025
f375ae0
Populate Deferred Action Invocations
mutahhir Oct 23, 2025
a3d693e
Change comment
mutahhir Oct 30, 2025
a594c77
Just trying to allow this for now
RonRicardo Nov 5, 2025
d2a6676
WIP
RonRicardo Nov 12, 2025
b17c456
Add test for raw action invocation with malformed action address
RonRicardo Nov 18, 2025
f9d5ffc
Forward the existing StartAction, ProgressAction, CompleteAction even…
RonRicardo Nov 20, 2025
5c2888e
proto: Add ActionInvocationStatus message and enum to StackChangeProg…
RonRicardo Nov 21, 2025
d13bb34
Update stacks.go to add ReportActionInvocationStatus hook
RonRicardo Nov 21, 2025
93f472a
Add ParseAbsActionInvocationInstance helpers
RonRicardo Nov 21, 2025
73e78ca
Add ActionInvocationStatusHookData struct
RonRicardo Nov 21, 2025
f64c999
Update hooks.go to use ActionInvocationStatusHookData for tthe hook, …
RonRicardo Nov 21, 2025
f3475e8
Test and capture ActionInvocationStatus hooks
RonRicardo Nov 21, 2025
269f6aa
Use NewActionInvocationInStackAddr
RonRicardo Nov 25, 2025
e2a9b83
WIP: lots of debug logging, trying to follow the flow of action invoc…
RonRicardo Nov 26, 2025
7e35bab
Transfer action invocations to plan and populate ActionTargetAddrs:
RonRicardo Dec 1, 2025
ccdb2bc
Add more logging to action invocatinon hooks
RonRicardo Dec 1, 2025
9b67ab1
Test hooks + add generated code
RonRicardo Dec 1, 2025
15ccb9b
Restore transform_action_diff.go
RonRicardo Dec 2, 2025
15c3f0a
Don't populate plan.ActionTargetAddrs
RonRicardo Dec 2, 2025
5ca0f7c
Add applied action invocation message type
RonRicardo Dec 2, 2025
a3c278c
Add ActionInvocationProgress message
RonRicardo Dec 3, 2025
52517a5
Generated from the proto
RonRicardo Dec 3, 2025
362e61b
Add ActionInvocationProgressHookData type
RonRicardo Dec 3, 2025
7d59cb5
Implement ProgressAction reporting
RonRicardo Dec 3, 2025
1d0ae23
Fire pending status during preApply
RonRicardo Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fire pending status during preApply
  • Loading branch information
RonRicardo committed Dec 3, 2025
commit 1d0ae2372defa9c7892b69e7943b316dad921bfe
20 changes: 20 additions & 0 deletions internal/stacks/stackruntime/internal/stackeval/applying.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,26 @@ func ApplyComponentPlan(ctx context.Context, main *Main, plan *plans.Plan, requi
hookSingle(ctx, hooksFromContext(ctx).PendingComponentInstanceApply, inst.Addr())
seq, ctx := hookBegin(ctx, h.BeginComponentInstanceApply, h.ContextAttach, inst.Addr())

// Fire PENDING status for all planned action invocations
// These actions are queued and ready to execute during the apply phase
if stackPlan != nil && stackPlan.ActionInvocations.Len() > 0 {
for _, elem := range stackPlan.ActionInvocations.Elems {
actionAddr := elem.Key
action := elem.Value

absActionAddr := stackaddrs.AbsActionInvocationInstance{
Component: inst.Addr(),
Item: actionAddr,
}

hookMore(ctx, seq, h.ReportActionInvocationStatus, &hooks.ActionInvocationStatusHookData{
Addr: absActionAddr,
ProviderAddr: action.ProviderAddr.Provider,
Status: hooks.ActionInvocationPending,
})
}
}

moduleTree := inst.ModuleTree(ctx)
if moduleTree == nil {
// We should not get here because if the configuration was statically
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,13 @@ func (h *componentInstanceTerraformHook) ResourceInstanceObjectsSuccessfullyAppl
return h.resourceInstanceObjectApplySuccess
}

// StartAction forwards core action start events into the stacks hooks
// as a status notification reporting that the action is now running.
// StartAction fires when action execution begins
func (h *componentInstanceTerraformHook) StartAction(id terraform.HookActionIdentity) (terraform.HookAction, error) {
log.Printf("[DEBUG] terraform_hook.StartAction called for action: %s", id.Addr.String())
ai := h.actionInvocationFromHookActionIdentity(id)
log.Printf("[DEBUG] Reporting action invocation status RUNNING: %s", ai.Addr.String())

// Report status transition: RUNNING (action execution starts)
// Note: PENDING status should have been reported during component apply preparation
hookMore(h.ctx, h.seq, h.hooks.ReportActionInvocationStatus, &hooks.ActionInvocationStatusHookData{
Addr: ai.Addr,
ProviderAddr: id.ProviderAddr.Provider,
Expand All @@ -219,40 +220,27 @@ func (h *componentInstanceTerraformHook) StartAction(id terraform.HookActionIden
return terraform.HookActionContinue, nil
}

// ProgressAction fires for intermediate diagnostic messages (NO status changes)
func (h *componentInstanceTerraformHook) ProgressAction(id terraform.HookActionIdentity, progress string) (terraform.HookAction, error) {
log.Printf("[DEBUG] terraform_hook.ProgressAction called for action: %s, progress=%s", id.Addr.String(), progress)
ai := h.actionInvocationFromHookActionIdentity(id)

// Report the progress message
log.Printf("[DEBUG] Reporting action invocation progress: %s", progress)
hookMore(h.ctx, h.seq, h.hooks.ReportActionInvocationProgress, &hooks.ActionInvocationProgressHookData{
Addr: ai.Addr,
ProviderAddr: id.ProviderAddr.Provider,
Message: progress,
})

// Map progress string to appropriate status
status := hooks.ActionInvocationRunning
if progress == "pending" {
status = hooks.ActionInvocationPending
log.Printf("[DEBUG] Mapping progress 'pending' to ActionInvocationPending")
} else {
log.Printf("[DEBUG] Mapping progress '%s' to ActionInvocationRunning", progress)
}

log.Printf("[DEBUG] Reporting action invocation status: %s", status.String())
hookMore(h.ctx, h.seq, h.hooks.ReportActionInvocationStatus, &hooks.ActionInvocationStatusHookData{
Addr: ai.Addr,
ProviderAddr: id.ProviderAddr.Provider,
Status: status,
})
return terraform.HookActionContinue, nil
}

// CompleteAction fires when action finishes (success or error)
func (h *componentInstanceTerraformHook) CompleteAction(id terraform.HookActionIdentity, err error) (terraform.HookAction, error) {
log.Printf("[DEBUG] terraform_hook.CompleteAction called for action: %s, error=%v", id.Addr.String(), err)
ai := h.actionInvocationFromHookActionIdentity(id)

// Report final status based on error
status := hooks.ActionInvocationCompleted
if err != nil {
status = hooks.ActionInvocationErrored
Expand All @@ -261,7 +249,7 @@ func (h *componentInstanceTerraformHook) CompleteAction(id terraform.HookActionI
log.Printf("[DEBUG] Action completed successfully - reporting COMPLETED status")
}

log.Printf("[DEBUG] Reporting action invocation status: %s", status.String())
// Report status transition: RUNNING → COMPLETED or ERRORED (action finishes)
hookMore(h.ctx, h.seq, h.hooks.ReportActionInvocationStatus, &hooks.ActionInvocationStatusHookData{
Addr: ai.Addr,
ProviderAddr: id.ProviderAddr.Provider,
Expand Down
Loading