|
|
|
|
@ -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,
|
|
|
|
|
@ -219,11 +220,11 @@ 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,
|
|
|
|
|
@ -231,28 +232,15 @@ func (h *componentInstanceTerraformHook) ProgressAction(id terraform.HookActionI
|
|
|
|
|
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
|
|
|
|
|
@ -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,
|
|
|
|
|
|