@@ -16,6 +16,13 @@ type ActionMetadata struct {
1616
1717// ActionServer is an interface containing the methods an action implementation needs to fill.
1818type ActionServer interface {
19+ // ValidateActionConfig is called when Terraform is checking that an
20+ // action configuration is valid. It is guaranteed to have types
21+ // conforming to your schema, but it is not guaranteed that all values
22+ // will be known. This is your opportunity to do custom or advanced
23+ // validation prior to an action being planned/invoked.
24+ ValidateActionConfig (context.Context , * ValidateActionConfigRequest ) (* ValidateActionConfigResponse , error )
25+
1926 // PlanAction is called when Terraform is attempting to
2027 // calculate a plan for an action. Depending on the type defined in
2128 // the action schema, Terraform may also pass the plan of linked resources
@@ -32,6 +39,35 @@ type ActionServer interface {
3239 InvokeAction (context.Context , * InvokeActionRequest ) (* InvokeActionServerStream , error )
3340}
3441
42+ // ValidateActionConfigRequest is the request Terraform sends when it
43+ // wants to validate an action's configuration.
44+ type ValidateActionConfigRequest struct {
45+ // ActionType is the type of action Terraform is validating.
46+ ActionType string
47+
48+ // Config is the configuration the user supplied for that action. See
49+ // the documentation on `DynamicValue` for more information about
50+ // safely accessing the configuration.
51+ //
52+ // The configuration is represented as a tftypes.Object, with each
53+ // attribute and nested block getting its own key and value.
54+ //
55+ // This configuration may contain unknown values if a user uses
56+ // interpolation or other functionality that would prevent Terraform
57+ // from knowing the value at request time. Any attributes not directly
58+ // set in the configuration will be null.
59+ Config * DynamicValue
60+ }
61+
62+ // ValidateActionConfigResponse is the response from the provider about
63+ // the validity of an action's configuration.
64+ type ValidateActionConfigResponse struct {
65+ // Diagnostics report errors or warnings related to the given
66+ // configuration. Returning an empty slice indicates a successful
67+ // validation with no warnings or errors generated.
68+ Diagnostics []* Diagnostic
69+ }
70+
3571// PlanActionRequest is the request Terraform sends when it is attempting to
3672// calculate a plan for an action.
3773type PlanActionRequest struct {
0 commit comments