x

package
v3.44.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 13

Documentation

Overview

Experimental extensions to the tfbridge module.

API exposed by this package is unstable and subject to change. As it stabilizes it will be moved to the parent package tfbridge.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoAliasing added in v3.43.0

func AutoAliasing(providerInfo *b.ProviderInfo, artifact b.ProviderMetadata) error

func ComputeDefaults

func ComputeDefaults(info *b.ProviderInfo, opts DefaultStrategy) error

Add mapped resources and datasources according to the given strategies.

Types

type DataSourceStrategy

type DataSourceStrategy = Strategy[tfbridge.DataSourceInfo]

A strategy for generating missing datasources.

type DefaultStrategy

type DefaultStrategy struct {
	Resource   ResourceStrategy
	DataSource DataSourceStrategy
}

Describe the mapping from resource and datasource tokens to Pulumi resources and datasources.

func TokensInferredModules added in v3.42.0

func TokensInferredModules(
	info *b.ProviderInfo, finalize MakeToken, opts *InferredModulesOpts,
) (DefaultStrategy, error)

A strategy to infer module placement from global analysis of all items (Resources & DataSources).

func TokensKnownModules

func TokensKnownModules(
	tfPackagePrefix, defaultModule string, modules []string, finalize MakeToken,
) DefaultStrategy

A strategy for assigning tokens to a hand generated set of modules.

If defaultModule is "", then the returned strategies will error on not encountering a matching module.

func TokensSingleModule

func TokensSingleModule(
	tfPackagePrefix, moduleName string, finalize MakeToken,
) DefaultStrategy

A strategy that assigns all tokens to the same module.

For example:

rStrat, dStrat := TokensSingleModule("pkgName_", "index", finalize)

The above example would transform "pkgName_foo" into "pkgName:index:Foo".

func (DefaultStrategy) Unmappable

func (ts DefaultStrategy) Unmappable(substring, reason string) DefaultStrategy

type InferredModulesOpts added in v3.42.0

type InferredModulesOpts struct {
	// The TF prefix of the package.
	TfPkgPrefix string
	// The name of the main module. Defaults to "index".
	MainModule string
	// The minimum number of shared items for a prefix before it becomes a module.
	//
	// < 0 -> don't bin into modules.
	// = 0 -> apply the default value.
	// > 0 -> set the value.
	MinimumModuleSize int
	// The number of items in a longer prefix needed to break out into it's own prefix.
	//
	// For example, with the tokens `pkg_mod_sub1_a`, `pkg_mod_sub2_b`, `pkg_mod_sub2_c`,
	// `pkg_mod_sub3_d`:
	//
	// MinimumSubmoduleSize = 3 will result in:
	//
	//	pkg:mod:Sub1A, pkg:mod:Sub2B, pkg:mod:Sub2C, pkg:mod:Sub3D
	//
	// MinimumSubmoduleSize = 2 will result in:
	//
	//	pkg:mod:Sub1A, pkg:modSub2:B, pkg:modSub2C, pkg:mod:Sub3D
	//
	// < 0 -> don't bin into submodules. Only the most common prefix will be used.
	// = 0 -> apply the default value.
	// > 0 -> set the value.
	MimimumSubmoduleSize int
}

type MakeToken

type MakeToken func(module, name string) (string, error)

A function that joins a module and name into a pulumi type token.

For example:

func(module, name string) (string, error) {
 return fmt.Sprintf("pkgName:%s:%s", module, name), nil
}

func MakeStandardToken

func MakeStandardToken(pkgName string) MakeToken

Convert a Terraform token to a Pulumi token with the standard mapping.

The mapping is

(pkg, module, name) => pkg:module/lowerFirst(name):name

type ResourceStrategy

type ResourceStrategy = Strategy[tfbridge.ResourceInfo]

A strategy for generating missing resources.

type Strategy

type Strategy[T tfbridge.ResourceInfo | tfbridge.DataSourceInfo] func(tfToken string) (*T, error)

A generic remapping strategy.

func (Strategy[T]) Unmappable

func (ts Strategy[T]) Unmappable(substring, reason string) Strategy[T]

Mark that a strategy cannot handle a sub-string.

type UnmappableError

type UnmappableError struct {
	TfToken string
	Reason  error
}

Indicate that a token cannot be mapped.

func (UnmappableError) Error

func (err UnmappableError) Error() string

func (UnmappableError) Unwrap

func (err UnmappableError) Unwrap() error

Jump to

Keyboard shortcuts

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