4 "github.com/hashicorp/terraform/configs/configschema"
5 "github.com/hashicorp/terraform/tfdiags"
6 "github.com/zclconf/go-cty/cty"
9 // Interface is the set of methods required for a resource provisioner plugin.
10 type Interface interface {
11 // GetSchema returns the schema for the provisioner configuration.
12 GetSchema() GetSchemaResponse
14 // ValidateProvisionerConfig allows the provisioner to validate the
15 // configuration values.
16 ValidateProvisionerConfig(ValidateProvisionerConfigRequest) ValidateProvisionerConfigResponse
18 // ProvisionResource runs the provisioner with provided configuration.
19 // ProvisionResource blocks until the execution is complete.
20 // If the returned diagnostics contain any errors, the resource will be
21 // left in a tainted state.
22 ProvisionResource(ProvisionResourceRequest) ProvisionResourceResponse
24 // Stop is called to interrupt the provisioner.
26 // Stop should not block waiting for in-flight actions to complete. It
27 // should take any action it wants and return immediately acknowledging it
28 // has received the stop request. Terraform will not make any further API
29 // calls to the provisioner after Stop is called.
31 // The error returned, if non-nil, is assumed to mean that signaling the
32 // stop somehow failed and that the user should expect potentially waiting
33 // a longer period of time.
36 // Close shuts down the plugin process if applicable.
40 type GetSchemaResponse struct {
41 // Provisioner contains the schema for this provisioner.
42 Provisioner *configschema.Block
44 // Diagnostics contains any warnings or errors from the method call.
45 Diagnostics tfdiags.Diagnostics
48 // UIOutput provides the Output method for resource provisioner
49 // plugins to write any output to the UI.
51 // Provisioners may call the Output method multiple times while Apply is in
52 // progress. It is invalid to call Output after Apply returns.
53 type UIOutput interface {
57 type ValidateProvisionerConfigRequest struct {
58 // Config is the complete configuration to be used for the provisioner.
62 type ValidateProvisionerConfigResponse struct {
63 // Diagnostics contains any warnings or errors from the method call.
64 Diagnostics tfdiags.Diagnostics
67 type ProvisionResourceRequest struct {
68 // Config is the complete provisioner configuration.
71 // Connection contains any information required to access the resource
75 // UIOutput is used to return output during the Apply operation.
79 type ProvisionResourceResponse struct {
80 // Diagnostics contains any warnings or errors from the method call.
81 Diagnostics tfdiags.Diagnostics