tokens

package
v3.56.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 174

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferredModules

func InferredModules(
	info *b.ProviderInfo, finalize Make, opts *InferredModulesOpts,
) (b.Strategy, error)

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

func KnownModules

func KnownModules(
	tfPackagePrefix, defaultModule string, modules []string, finalize Make,
) b.Strategy

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 MappedModules

func MappedModules(
	tfPackagePrefix, defaultModule string, modules map[string]string, finalize Make,
) b.Strategy

A strategy for assigning tokens to a hand generated set of modules with an arbitrary mapping from TF modules to Pulumi modules.

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

func SingleModule

func SingleModule(
	tfPackagePrefix, moduleName string, finalize Make,
) b.Strategy

A strategy that assigns all tokens to the same module.

For example:

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

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

Types

type InferredModulesOpts

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 Make

type Make 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 MakeStandard

func MakeStandard(pkgName string) Make

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

The mapping is

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

Jump to

Keyboard shortcuts

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