@@ -43,10 +43,12 @@ type ComponentInstance struct {
4343 inputVariableValues perEvalPhase [promising.Once [withDiagnostics [cty.Value ]]]
4444}
4545
46- var _ Applyable = (* ComponentInstance )(nil )
47- var _ Plannable = (* ComponentInstance )(nil )
48- var _ ExpressionScope = (* ComponentInstance )(nil )
49- var _ ConfigComponentExpressionScope [stackaddrs.AbsComponentInstance ] = (* ComponentInstance )(nil )
46+ var (
47+ _ Applyable = (* ComponentInstance )(nil )
48+ _ Plannable = (* ComponentInstance )(nil )
49+ _ ExpressionScope = (* ComponentInstance )(nil )
50+ _ ConfigComponentExpressionScope [stackaddrs.AbsComponentInstance ] = (* ComponentInstance )(nil )
51+ )
5052
5153func newComponentInstance (call * Component , addr stackaddrs.AbsComponentInstance , repetition instances.RepetitionData , mode plans.Mode , deferred bool ) * ComponentInstance {
5254 component := & ComponentInstance {
@@ -137,7 +139,6 @@ func (c *ComponentInstance) inputValuesForModulesRuntime(ctx context.Context, ph
137139 }
138140 }
139141 return ret
140-
141142}
142143
143144func (c * ComponentInstance ) PlanOpts (ctx context.Context , mode plans.Mode , skipRefresh bool ) (* terraform.PlanOpts , tfdiags.Diagnostics ) {
@@ -795,6 +796,25 @@ func (c *ComponentInstance) ResourceSchema(ctx context.Context, providerTypeAddr
795796 return ret , nil
796797}
797798
799+ // ActionSchema implements stackplan.PlanProducer.
800+ func (c * ComponentInstance ) ActionSchema (ctx context.Context , providerTypeAddr addrs.Provider , typ string ) (providers.ActionSchema , error ) {
801+ // This should not be able to fail with an error because we should
802+ // be retrieving the same schema that was already used to encode
803+ // the object we're working with. The error handling here is for
804+ // robustness but any error here suggests a bug in Terraform.
805+
806+ providerType := c .main .ProviderType (providerTypeAddr )
807+ providerSchema , err := providerType .Schema (ctx )
808+ if err != nil {
809+ return providers.ActionSchema {}, err
810+ }
811+ ret := providerSchema .SchemaForActionType (typ )
812+ if ret .ConfigSchema == nil {
813+ return providers.ActionSchema {}, fmt .Errorf ("schema does not include %q" , typ )
814+ }
815+ return ret , nil
816+ }
817+
798818// RequiredComponents implements stackplan.PlanProducer.
799819func (c * ComponentInstance ) RequiredComponents (ctx context.Context ) collections.Set [stackaddrs.AbsComponent ] {
800820 return c .call .RequiredComponents (ctx )
0 commit comments