From 547473364c402d13e34c54dc20be419209b9c701 Mon Sep 17 00:00:00 2001 From: Mutahhir Hayat Date: Tue, 13 Jan 2026 12:57:39 +0100 Subject: [PATCH] Expose Action Invocation conversion to Proto publicly --- internal/plans/planfile/tfplan.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/internal/plans/planfile/tfplan.go b/internal/plans/planfile/tfplan.go index 5e430c59ce..05896b7a86 100644 --- a/internal/plans/planfile/tfplan.go +++ b/internal/plans/planfile/tfplan.go @@ -26,8 +26,10 @@ import ( "github.com/hashicorp/terraform/version" ) -const tfplanFormatVersion = 3 -const tfplanFilename = "tfplan" +const ( + tfplanFormatVersion = 3 + tfplanFilename = "tfplan" +) // --------------------------------------------------------------------------- // This file deals with the internal structure of the "tfplan" sub-file within @@ -410,7 +412,6 @@ func ActionFromProto(rawAction planproto.Action) (plans.Action, error) { default: return plans.NoOp, fmt.Errorf("invalid change action %s", rawAction) } - } func changeFromTfplan(rawChange *planproto.Change) (*plans.ChangeSrc, error) { @@ -1448,3 +1449,12 @@ func actionInvocationToTfPlan(action *plans.ActionInvocationInstanceSrc) (*planp return ret, nil } + +// ActionInvocationToProto encodes an action invocation from its internal +// representation into the protobuf representation for persistence. +// +// This is a public wrapper around actionInvocationToTfPlan for use by +// external packages like stackplan. +func ActionInvocationToProto(action *plans.ActionInvocationInstanceSrc) (*planproto.ActionInvocationInstance, error) { + return actionInvocationToTfPlan(action) +}