@@ -512,7 +512,12 @@ type terraformNodeHooks struct {
512512}
513513
514514// Before implements schema.ComponentNodeHooks.
515- func (n * terraformNodeHooks ) Before (_ context.Context , info * schema.ConfigAndStacksInfo ) error {
515+ func (n * terraformNodeHooks ) Before (ctx context.Context , info * schema.ConfigAndStacksInfo ) error {
516+ return n .BeforeWithWriters (ctx , info , schema.ComponentNodeHookWriters {})
517+ }
518+
519+ // BeforeWithWriters implements schema.ComponentNodeHooksWithOutput.
520+ func (n * terraformNodeHooks ) BeforeWithWriters (_ context.Context , info * schema.ConfigAndStacksInfo , writers schema.ComponentNodeHookWriters ) error {
516521 defer perf .Track (nil , "terraform.terraformNodeHooks.Before" )()
517522
518523 injectLastAuthContext (info )
@@ -526,11 +531,16 @@ func (n *terraformNodeHooks) Before(_ context.Context, info *schema.ConfigAndSta
526531 // identity-aware store hooks (for example, after-apply output publishing)
527532 // do not fall back to ambient credentials.
528533 injectHookStoreAuthResolver (& atmosConfig , info )
529- return n .runUserHooksForNode (& atmosConfig , info , n .beforeEvent , h.Outcome {Status : h .RunSuccess })
534+ return n .runUserHooksForNodeWithWriters (& atmosConfig , info , n .beforeEvent , h.Outcome {Status : h .RunSuccess }, writers )
530535}
531536
532537// After implements schema.ComponentNodeHooks.
533- func (n * terraformNodeHooks ) After (_ context.Context , info * schema.ConfigAndStacksInfo , output string , execErr error ) error {
538+ func (n * terraformNodeHooks ) After (ctx context.Context , info * schema.ConfigAndStacksInfo , output string , execErr error ) error {
539+ return n .AfterWithWriters (ctx , info , output , execErr , schema.ComponentNodeHookWriters {})
540+ }
541+
542+ // AfterWithWriters implements schema.ComponentNodeHooksWithOutput.
543+ func (n * terraformNodeHooks ) AfterWithWriters (_ context.Context , info * schema.ConfigAndStacksInfo , output string , execErr error , writers schema.ComponentNodeHookWriters ) error {
534544 defer perf .Track (nil , "terraform.terraformNodeHooks.After" )()
535545
536546 injectLastAuthContext (info )
@@ -547,7 +557,7 @@ func (n *terraformNodeHooks) After(_ context.Context, info *schema.ConfigAndStac
547557 if execErr != nil {
548558 outcome = h.Outcome {Status : h .RunFailure , Err : execErr , ExitCode : errUtils .GetExitCode (execErr )}
549559 }
550- hookErr := n .runUserHooksForNode (& atmosConfig , info , n .afterEvent , outcome )
560+ hookErr := n .runUserHooksForNodeWithWriters (& atmosConfig , info , n .afterEvent , outcome , writers )
551561
552562 if ! n .skipPerNodeCI {
553563 n .runCIHooksForNode (& atmosConfig , info , output , execErr )
@@ -575,6 +585,10 @@ func injectLastAuthContext(info *schema.ConfigAndStacksInfo) {
575585// verbatim: RunAll already resolves each hook's on_failure mode internally
576586// (applyOnFailure) — a non-nil return specifically means on_failure: fail.
577587func (n * terraformNodeHooks ) runUserHooksForNode (atmosConfig * schema.AtmosConfiguration , info * schema.ConfigAndStacksInfo , event h.HookEvent , outcome h.Outcome ) error {
588+ return n .runUserHooksForNodeWithWriters (atmosConfig , info , event , outcome , schema.ComponentNodeHookWriters {})
589+ }
590+
591+ func (n * terraformNodeHooks ) runUserHooksForNodeWithWriters (atmosConfig * schema.AtmosConfiguration , info * schema.ConfigAndStacksInfo , event h.HookEvent , outcome h.Outcome , writers schema.ComponentNodeHookWriters ) error {
578592 if event == "" {
579593 return nil
580594 }
@@ -585,6 +599,8 @@ func (n *terraformNodeHooks) runUserHooksForNode(atmosConfig *schema.AtmosConfig
585599 Cmd : n .cmd ,
586600 Args : n .args ,
587601 Outcome : outcome ,
602+ Stdout : writers .Stdout ,
603+ Stderr : writers .Stderr ,
588604 })
589605}
590606
0 commit comments