A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pkg.go.dev/github.com/hashicorp/terraform-plugin-mux/tf5muxserver below:

tf5muxserver package - github.com/hashicorp/terraform-plugin-mux/tf5muxserver - Go Packages

Package tf5muxserver combines multiple provider servers that implement protocol version 5, into a single server.

Supported protocol version 5 provider servers include any which implement the tfprotov5.ProviderServer (https://pkg.go.dev/github.com/hashicorp/terraform-plugin-go/tfprotov5#ProviderServer) interface, such as:

Refer to the NewMuxServer() function for creating a combined server.

This section is empty.

This section is empty.

NewMuxServer returns a muxed server that will route gRPC requests between tfprotov5.ProviderServers specified. The GetProviderSchema method of each is called to verify that the overall muxed server is compatible by ensuring:

package main

import (
	"context"
	"log"

	"github.com/hashicorp/terraform-plugin-go/tfprotov5"
	"github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server"
	"github.com/hashicorp/terraform-plugin-mux/tf5muxserver"
)

func main() {
	ctx := context.Background()
	providers := []func() tfprotov5.ProviderServer{
		// Example terraform-plugin-sdk ProviderServer function
		// sdkprovider.New("version")().GRPCProvider,
		//
		// 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 := tf5muxserver.NewMuxServer(ctx, providers...)

	if err != nil {
		log.Fatalln(err.Error())
	}

	// Use the result to start a muxed provider
	err = tf5server.Serve("registry.terraform.io/namespace/example", muxServer.ProviderServer)

	if err != nil {
		log.Fatalln(err.Error())
	}
}

This section is empty.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4