tfbridge

package
v3.93.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 47 Imported by: 32

Documentation

Overview

Package tfbridge implements adapters for constructing Pulumi Resource Providers from Terraform providers built with the Terraform Plugin Framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(ctx context.Context, pkg string, prov tfbridge.ProviderInfo, meta ProviderMetadata)

Implements main() or a bridged Pulumi plugin, complete with argument parsing.

info.P must be constructed with ShimProvider or ShimProviderWithContext.

func MainWithMuxer

func MainWithMuxer(ctx context.Context, pkg string, info tfbridge.ProviderInfo, schema []byte)

Implements main() or a bridged Pulumi plugin, complete with argument parsing.

This is an experimental API.

func MakeMuxedServer

func MakeMuxedServer(
	ctx context.Context, pkg string, info tfbridge.ProviderInfo, schema []byte,
) func(host *rprovider.HostClient) (pulumirpc.ResourceProviderServer, error)

Create a function to produce a Muxed provider.

This function exposes implementation details for testing. It should not be used outside of pulumi-terraform-bridge. This is an experimental API.

func MuxShimWithDisjointgPF

func MuxShimWithDisjointgPF(ctx context.Context, shim shim.Provider, p pfprovider.Provider) shim.Provider

MuxShimWithDisjointgPF initializes a shim.Provider that will server resources from both shim and p.

This function will panic if shim and p both define the same token.

To create a muxed provider, ProviderInfo.P must be the result of this function.

func MuxShimWithPF

func MuxShimWithPF(ctx context.Context, shim shim.Provider, p pfprovider.Provider) shim.Provider

MuxShimWithPF initializes a shim.Provider that will server resources from both shim and p.

If shim and p both define the same token, then the value from shim will be used.

To create a muxed provider, ProviderInfo.P must be the result of this function.

func NewMuxProvider

func NewMuxProvider(ctx context.Context, providerInfo info.Provider, meta *ProviderMetadata) (info.MuxProvider, error)

Adapts a provider to be usable as a mix-in, see info.Provider.MuxWith.

info.P must be constructed with ShimProvider or ShimProviderWithContext.

func NewProvider

func NewProvider(ctx context.Context, info tfbridge.ProviderInfo, meta ProviderMetadata) (plugin.Provider, error)

Adapts a provider to Pulumi. Most users do not need to call this directly but instead use Main to build a fully functional binary.

info.P must be constructed with ShimProvider or ShimProviderWithContext.

func NewProviderServer

func NewProviderServer(
	ctx context.Context,
	logSink logging.Sink,
	info tfbridge.ProviderInfo,
	meta ProviderMetadata,
) (pulumirpc.ResourceProviderServer, error)

Internal. The signature of this function can change between major releases. Exposed to facilitate testing.

func SchemaOnlyPluginFrameworkProvider deprecated

func SchemaOnlyPluginFrameworkProvider(ctx context.Context, p pfprovider.Provider) shim.Provider

Wrap a PF Provider in a shim.Provider.

Deprecated: This function has been renamed ShimProviderWithContext.

func ShimProvider

func ShimProvider(p pfprovider.Provider) shim.Provider

Wrap a PF Provider in a shim.Provider.

func ShimProviderWithContext

func ShimProviderWithContext(ctx context.Context, p pfprovider.Provider) shim.Provider

Wrap a PF Provider in a shim.Provider with the given context.Context.

func XParameterizeResetProvider

func XParameterizeResetProvider(ctx context.Context, info tfbridge.ProviderInfo, meta ProviderMetadata) error

XParameterizeResetProvider resets the enclosing PF provider with a new info and meta combination.

XParameterizeResetProvider is an unstable method and may change in any bridge release. It is intended only for internal use.

Types

type ProviderMetadata

type ProviderMetadata struct {
	// JSON-serialzed Pulumi Package Schema.
	PackageSchema []byte

	// Deprecated. This field is no longer in use and will be removed in future versions.
	BridgeMetadata []byte

	// XParamaterize overrides the functionality of the Paramaterize call.
	//
	// XParamaterize is an experimental API and should not be used by 3rd parties. It
	// does not have a backwards compatibility guarantee and may be removed in the
	// future.
	XParamaterize func(context.Context, plugin.ParameterizeRequest) (plugin.ParameterizeResponse, error)

	// XGetSchema overrides the functionality of the GetSchema call. Either XGetSchema
	// or PackageSchema must be set. If both are set, then the provider will panic
	// during startup.
	//
	// XGetSchema is an experimental API and should not be used by 3rd parties. It
	// does not have a backwards compatibility guarantee and may be removed in the
	// future.
	XGetSchema func(context.Context, plugin.GetSchemaRequest) ([]byte, error)
}

Defines bridged provider metadata that is pre-computed at build time with tfgen (tfgen ("github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfgen") and typically made available to the provider binary at runtime with embed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL