Documentation
¶
Overview ¶
Package providerserver implements functionality for serving a provider, such as directly starting a server in a production binary and conversion functions for testing.
Index ¶
- func NewProtocol5(p tfsdk.Provider) func() tfprotov5.ProviderServer
- func NewProtocol5WithError(p tfsdk.Provider) func() (tfprotov5.ProviderServer, error)
- func NewProtocol6(p tfsdk.Provider) func() tfprotov6.ProviderServer
- func NewProtocol6WithError(p tfsdk.Provider) func() (tfprotov6.ProviderServer, error)
- func Serve(ctx context.Context, providerFunc func() tfsdk.Provider, opts ServeOpts) error
- type ServeOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProtocol5 ¶ added in v0.9.0
func NewProtocol5(p tfsdk.Provider) func() tfprotov5.ProviderServer
NewProtocol5 returns a protocol version 5 ProviderServer implementation based on the given Provider and suitable for usage with the github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.Serve() function and various terraform-plugin-mux functions.
func NewProtocol5WithError ¶ added in v0.9.0
func NewProtocol5WithError(p tfsdk.Provider) func() (tfprotov5.ProviderServer, error)
NewProtocol5WithError returns a protocol version 5 ProviderServer implementation based on the given Provider and suitable for usage with github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.TestCase.ProtoV5ProviderFactories.
The error return is not currently used, but it may be in the future.
func NewProtocol6 ¶
func NewProtocol6(p tfsdk.Provider) func() tfprotov6.ProviderServer
NewProtocol6 returns a protocol version 6 ProviderServer implementation based on the given Provider and suitable for usage with the github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.Serve() function and various terraform-plugin-mux functions.
func NewProtocol6WithError ¶
func NewProtocol6WithError(p tfsdk.Provider) func() (tfprotov6.ProviderServer, error)
NewProtocol6WithError returns a protocol version 6 ProviderServer implementation based on the given Provider and suitable for usage with github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.TestCase.ProtoV6ProviderFactories.
The error return is not currently used, but it may be in the future.
Types ¶
type ServeOpts ¶
type ServeOpts struct {
// Address is the full address of the provider. Full address form has three
// parts separated by forward slashes (/): Hostname, namespace, and
// provider type ("name").
//
// For example: registry.terraform.io/hashicorp/random.
Address string
// Debug runs the provider in a mode acceptable for debugging and testing
// processes, such as delve, by managing the process lifecycle. Information
// needed for Terraform CLI to connect to the provider is output to stdout.
// os.Interrupt (Ctrl-c) can be used to stop the provider.
Debug bool
// ProtocolVersion is the protocol version that should be used when serving
// the provider. Either protocol version 5 or protocol version 6 can be
// used. Defaults to protocol version 6.
//
// Protocol version 5 has the following functionality limitations, which
// will raise an error during the GetProviderSchema or other RPCs:
//
// - tfsdk.Attribute cannot use Attributes field (nested attributes).
//
ProtocolVersion int
}
ServeOpts are options for serving the provider.