Documentation ¶
Overview ¶
Package tf6muxserver combines multiple provider servers that implement protocol version 6, into a single server.
Supported protocol version 6 provider servers include any which implement the tfprotov6.ProviderServer (https://pkg.go.dev/github.com/hashicorp/terraform-plugin-go/tfprotov6#ProviderServer) interface, such as:
- https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework
- https://pkg.go.dev/github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server
- https://pkg.go.dev/github.com/hashicorp/terraform-plugin-mux/tf5to6server
Refer to the NewMuxServer() function for creating a combined server.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMuxServer ¶
func NewMuxServer(_ context.Context, servers ...func() tfprotov6.ProviderServer) (*muxServer, error)
NewMuxServer returns a muxed server that will route gRPC requests between tfprotov6.ProviderServers specified. When the GetProviderSchema RPC of each is called, there is verification that the overall muxed server is compatible by ensuring:
- All provider schemas exactly match
- All provider meta schemas exactly match
- Only one provider implements each managed resource
- Only one provider implements each data source
- Only one provider implements each function
- Only one provider implements each ephemeral resource
Example ¶
package main import ( "context" "log" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server" "github.com/hashicorp/terraform-plugin-mux/tf6muxserver" ) func main() { ctx := context.Background() providers := []func() tfprotov6.ProviderServer{ // Example terraform-plugin-framework ProviderServer function // func() tfprotov6.ProviderServer { // return tfsdk.NewProtocol6Server(frameworkprovider.New("version")()) // }, // // Example terraform-plugin-go ProviderServer function // goprovider.Provider(), } // requests will be routed to whichever server advertises support for // them in the GetSchema response. Only one server may advertise // support for any given resource, data source, or the provider or // provider_meta schemas. An error will be returned if more than one // server claims support. muxServer, err := tf6muxserver.NewMuxServer(ctx, providers...) if err != nil { log.Fatalln(err.Error()) } // Use the result to start a muxed provider err = tf6server.Serve("registry.terraform.io/namespace/example", muxServer.ProviderServer) if err != nil { log.Fatalln(err.Error()) } }
Output:
Types ¶
This section is empty.
Source Files ¶
- diagnostics.go
- doc.go
- mux_server.go
- mux_server_ApplyResourceChange.go
- mux_server_CallFunction.go
- mux_server_CloseEphemeralResource.go
- mux_server_ConfigureProvider.go
- mux_server_GetFunctions.go
- mux_server_GetMetadata.go
- mux_server_GetProviderSchema.go
- mux_server_ImportResourceState.go
- mux_server_MoveResourceState.go
- mux_server_OpenEphemeralResource.go
- mux_server_PlanResourceChange.go
- mux_server_ReadDataSource.go
- mux_server_ReadResource.go
- mux_server_RenewEphemeralResource.go
- mux_server_StopProvider.go
- mux_server_UpgradeResourceState.go
- mux_server_ValidateDataResourceConfig.go
- mux_server_ValidateEphemeralResourceConfig.go
- mux_server_ValidateProviderConfig.go
- mux_server_ValidateResourceConfig.go
- schema_equality.go
- server_capabilities.go