Documentation ¶
Index ¶
- Constants
- Variables
- func BoolRef(b bool) *bool
- func CoerceTerraformString(schType shim.ValueType, ps *SchemaInfo, stringValue string) (interface{}, error)
- func ConfigArrayValue(vars resource.PropertyMap, prop resource.PropertyKey, envs []string) []string
- func ConfigBoolValue(vars resource.PropertyMap, prop resource.PropertyKey, envs []string) bool
- func ConfigStringValue(vars resource.PropertyMap, prop resource.PropertyKey, envs []string) string
- func ExtractInputsFromOutputs(oldInputs, outs resource.PropertyMap, tfs shim.SchemaMap, ...) (resource.PropertyMap, error)
- func False() *bool
- func FromName(options AutoNameOptions) func(res *PulumiResource) (interface{}, error)
- func GetModuleMajorVersion(version string) string
- func IsMaxItemsOne(tfs shim.Schema, info *SchemaInfo) bool
- func Main(pkg string, version string, prov ProviderInfo, pulumiSchema []byte, ...)
- func MakeDataSource(pkg string, mod string, name string) tokens.ModuleMember
- func MakeMember(pkg string, mod string, mem string) tokens.ModuleMemberdeprecated
- func MakeResource(pkg string, mod string, res string) tokens.Type
- func MakeTerraformConfigFromInputs(p shim.Provider, inputs map[string]interface{}) shim.ResourceConfig
- func MakeTerraformOutput(p shim.Provider, v interface{}, tfs shim.Schema, ps *SchemaInfo, ...) resource.PropertyValue
- func MakeTerraformOutputs(p shim.Provider, outs map[string]interface{}, tfs shim.SchemaMap, ...) resource.PropertyMap
- func MakeTerraformResult(p shim.Provider, state shim.InstanceState, tfs shim.SchemaMap, ...) (resource.PropertyMap, error)
- func MakeTerraformState(res Resource, id string, m resource.PropertyMap) (shim.InstanceState, error)
- func MakeType(pkg string, mod string, typ string) tokens.Typedeprecated
- func MarkSchemaSecrets(ctx context.Context, schemaMap shim.SchemaMap, ...) resource.PropertyValue
- func NewCheckFailure(reasonType CheckFailureReason, reason string, pp *CheckFailurePath, ...) plugin.CheckFailure
- func PulumiToTerraformName(name string, tfs shim.SchemaMap, ps map[string]*SchemaInfo) string
- func Serve(module string, version string, info ProviderInfo, pulumiSchema []byte, ...) error
- func StringValue(vars resource.PropertyMap, prop resource.PropertyKey) string
- func TerraformToPulumiName(name string, sch shim.Schema, ps *SchemaInfo, upper bool) stringdeprecated
- func TerraformToPulumiNameAtPath(path walk.SchemaPath, sch shim.SchemaMap, ps map[string]*SchemaInfo) (string, error)
- func TerraformToPulumiNameV2(name string, sch shim.SchemaMap, ps map[string]*SchemaInfo) string
- func TransformJSONDocument(v resource.PropertyValue) (resource.PropertyValue, error)
- func True() *bool
- func UnmarshalTerraformState(r Resource, id string, m *pbstruct.Struct, l string) (shim.InstanceState, error)
- type AliasInfo
- type AssetTable
- func MakeTerraformConfig(p *Provider, m resource.PropertyMap, tfs shim.SchemaMap, ...) (shim.ResourceConfig, AssetTable, error)
- func MakeTerraformInputs(instance *PulumiResource, config resource.PropertyMap, ...) (map[string]interface{}, AssetTable, error)
- func UnmarshalTerraformConfig(p *Provider, m *pbstruct.Struct, tfs shim.SchemaMap, ps map[string]*SchemaInfo, ...) (shim.ResourceConfig, AssetTable, error)
- type AssetTranslation
- func (a *AssetTranslation) IsArchive() bool
- func (a *AssetTranslation) IsAsset() bool
- func (a *AssetTranslation) TranslateArchive(archive *resource.Archive) (interface{}, error)
- func (a *AssetTranslation) TranslateAsset(asset *resource.Asset) (interface{}, error)
- func (a *AssetTranslation) Type() string
- type AssetTranslationKind
- type AutoNameOptions
- type CSharpInfo
- type CheckFailurePath
- type CheckFailureReason
- type ConfigEncoding
- type ConfigInfo
- type DataSource
- type DataSourceInfo
- type DefaultInfo
- type DocInfo
- type DocRuleInfo
- type DocsEdit
- type DocsPathInfo
- type GolangInfo
- type HclExampler
- type InlineHclExample
- type JavaInfo
- type JavaScriptInfo
- type LocalFileHclExample
- type LogRedirector
- type MakeEditRules
- type MarshallableDataSourceInfo
- type MarshallableDefaultInfo
- type MarshallableElem
- type MarshallableProvider
- type MarshallableProviderInfo
- type MarshallableResource
- type MarshallableResourceInfo
- type MarshallableSchema
- type MarshallableSchemaInfo
- type MetadataInfo
- type Option
- type OverlayInfo
- type PreConfigureCallback
- type PreConfigureCallbackWithLogger
- type PreStateUpgradeHook
- type PreStateUpgradeHookArgs
- type Provider
- func (p *Provider) Attach(context context.Context, req *pulumirpc.PluginAttach) (*emptypb.Empty, error)
- func (p *Provider) Call(ctx context.Context, req *pulumirpc.CallRequest) (*pulumirpc.CallResponse, error)
- func (p *Provider) Cancel(ctx context.Context, req *pbempty.Empty) (*pbempty.Empty, error)
- func (p *Provider) Check(ctx context.Context, req *pulumirpc.CheckRequest) (*pulumirpc.CheckResponse, error)
- func (p *Provider) CheckConfig(ctx context.Context, req *pulumirpc.CheckRequest) (*pulumirpc.CheckResponse, error)
- func (p *Provider) Configure(ctx context.Context, req *pulumirpc.ConfigureRequest) (*pulumirpc.ConfigureResponse, error)
- func (p *Provider) Construct(context.Context, *pulumirpc.ConstructRequest) (*pulumirpc.ConstructResponse, error)
- func (p *Provider) Create(ctx context.Context, req *pulumirpc.CreateRequest) (*pulumirpc.CreateResponse, error)
- func (p *Provider) Delete(ctx context.Context, req *pulumirpc.DeleteRequest) (*pbempty.Empty, error)
- func (p *Provider) Diff(ctx context.Context, req *pulumirpc.DiffRequest) (*pulumirpc.DiffResponse, error)
- func (p *Provider) DiffConfig(ctx context.Context, req *pulumirpc.DiffRequest) (*pulumirpc.DiffResponse, error)
- func (p *Provider) GetMapping(ctx context.Context, req *pulumirpc.GetMappingRequest) (*pulumirpc.GetMappingResponse, error)
- func (p *Provider) GetPluginInfo(ctx context.Context, req *pbempty.Empty) (*pulumirpc.PluginInfo, error)
- func (p *Provider) GetSchema(ctx context.Context, req *pulumirpc.GetSchemaRequest) (*pulumirpc.GetSchemaResponse, error)
- func (p *Provider) Invoke(ctx context.Context, req *pulumirpc.InvokeRequest) (*pulumirpc.InvokeResponse, error)
- func (p *Provider) Read(ctx context.Context, req *pulumirpc.ReadRequest) (*pulumirpc.ReadResponse, error)
- func (p *Provider) StreamInvoke(req *pulumirpc.InvokeRequest, ...) error
- func (p *Provider) Update(ctx context.Context, req *pulumirpc.UpdateRequest) (*pulumirpc.UpdateResponse, error)
- type ProviderInfo
- func (info *ProviderInfo) GetConfig() map[string]*SchemaInfo
- func (info ProviderInfo) GetGitHubHost() string
- func (info ProviderInfo) GetGitHubOrg() string
- func (info ProviderInfo) GetMetadata() ProviderMetadata
- func (info ProviderInfo) GetProviderModuleVersion() string
- func (info ProviderInfo) GetResourcePrefix() string
- func (info ProviderInfo) GetTFProviderLicense() TFProviderLicense
- func (p *ProviderInfo) RenameDataSource(resourceName string, legacyTok tokens.ModuleMember, newTok tokens.ModuleMember, ...)
- func (p *ProviderInfo) RenameResourceWithAlias(resourceName string, legacyTok tokens.Type, newTok tokens.Type, ...)
- func (p *ProviderInfo) SetAutonaming(maxLength int, separator string)
- type ProviderMetadata
- type PulumiResource
- type PythonInfo
- type Resource
- type ResourceInfo
- type ResourceOrDataSourceInfo
- type SchemaInfo
- func AutoName(name string, maxlength int, separator string) *SchemaInfo
- func AutoNameTransform(name string, maxlen int, transform func(string) string) *SchemaInfo
- func AutoNameWithCustomOptions(name string, options AutoNameOptions) *SchemaInfo
- func LookupSchemaInfoMapPath(schemaPath SchemaPath, schemaInfos map[string]*SchemaInfo) *SchemaInfo
- func LookupSchemaInfoPath(schemaPath SchemaPath, schemaInfo *SchemaInfo) *SchemaInfo
- func LookupSchemas(schemaPath walk.SchemaPath, schemaMap shim.SchemaMap, ...) (shim.Schema, *SchemaInfo, error)
- type SchemaPath
- type SkipExamplesArgs
- type TFProviderLicense
- type Transformer
Constants ¶
const (
RenamedEntitySuffix string = "_legacy"
)
const TerraformUnknownVariableValue = "74D93920-ED26-11E3-AC10-0800200C9A66"
TerraformUnknownVariableValue is the sentinal defined in github.com/hashicorp/terraform/configs/hcl2shim, representing a variable whose value is not known at some particular time. The value is duplicated here in order to prevent an additional dependency - it is unlikely to ever change upstream since that would break rather a lot of things.
Variables ¶
var ManagedByPulumi = &DefaultInfo{Value: "Managed by Pulumi"}
ManagedByPulumi is a default used for some managed resources, in the absence of something more meaningful.
Functions ¶
func CoerceTerraformString ¶
func CoerceTerraformString(schType shim.ValueType, ps *SchemaInfo, stringValue string) (interface{}, error)
CoerceTerraformString coerces a string value to a Go value whose type is the type requested by the Terraform schema type or the Pulumi SchemaInfo. We prefer the SchemaInfo overrides as it's an explicit call to action over the Terraform Schema. Returns an error if the string can't be successfully coerced to the requested type.
func ConfigArrayValue ¶ added in v3.30.1
func ConfigArrayValue(vars resource.PropertyMap, prop resource.PropertyKey, envs []string) []string
ConfigArrayValue takes an array value from a property map, then from environment vars; defaults to an empty array
func ConfigBoolValue ¶ added in v3.30.1
func ConfigBoolValue(vars resource.PropertyMap, prop resource.PropertyKey, envs []string) bool
ConfigBoolValue takes a bool value from a property map, then from environment vars; defaults to false
func ConfigStringValue ¶ added in v3.30.1
func ConfigStringValue(vars resource.PropertyMap, prop resource.PropertyKey, envs []string) string
ConfigStringValue gets a string value from a property map, then from environment vars; defaults to empty string ""
func ExtractInputsFromOutputs ¶ added in v3.43.0
func ExtractInputsFromOutputs(oldInputs, outs resource.PropertyMap, tfs shim.SchemaMap, ps map[string]*SchemaInfo, isRefresh bool) (resource.PropertyMap, error)
func False ¶
func False() *bool
False is used for interations in the providers that require a pointer to false
func FromName ¶
func FromName(options AutoNameOptions) func(res *PulumiResource) (interface{}, error)
FromName automatically propagates a resource's URN onto the resulting default info.
func GetModuleMajorVersion ¶
Calculates the major version of a go sdk go module paths only care about appending a version when the version is 2 or greater. github.com/org/my-repo/sdk/v1/go is not a valid go module path but github.com/org/my-repo/sdk/v2/go is
func IsMaxItemsOne ¶
func IsMaxItemsOne(tfs shim.Schema, info *SchemaInfo) bool
IsMaxItemsOne returns true if the schema/info pair represents a TypeList or TypeSet which should project as a scalar, else returns false.
func Main ¶
func Main(pkg string, version string, prov ProviderInfo, pulumiSchema []byte, opts ...Option)
Main launches the tfbridge plugin for a given package pkg and provider prov.
func MakeDataSource ¶ added in v3.12.0
func MakeDataSource(pkg string, mod string, name string) tokens.ModuleMember
MakeDataSource manufactures a standard Pulumi function token given a package, module, and data source name. It automatically uses the main package and names the file by simply lower casing the data source's first character.
Invalid inputs panic.
func MakeMember
deprecated
added in
v3.12.0
func MakeMember(pkg string, mod string, mem string) tokens.ModuleMember
MakeMember manufactures a type token for the package and the given module and type.
Deprecated: Use MakeResource or call into the `tokens` module in "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" directly.
func MakeResource ¶ added in v3.12.0
MakeResource manufactures a standard resource token given a package, module and resource name. It automatically uses the main package and names the file by simply lower casing the resource's first character.
Invalid inputs panic.
func MakeTerraformConfigFromInputs ¶
func MakeTerraformConfigFromInputs(p shim.Provider, inputs map[string]interface{}) shim.ResourceConfig
MakeTerraformConfigFromInputs creates a new Terraform configuration object from a set of Terraform inputs.
func MakeTerraformOutput ¶
func MakeTerraformOutput(p shim.Provider, v interface{}, tfs shim.Schema, ps *SchemaInfo, assets AssetTable, rawNames, supportsSecrets bool) resource.PropertyValue
MakeTerraformOutput takes a single Terraform property and returns the Pulumi equivalent.
func MakeTerraformOutputs ¶
func MakeTerraformOutputs(p shim.Provider, outs map[string]interface{}, tfs shim.SchemaMap, ps map[string]*SchemaInfo, assets AssetTable, rawNames, supportsSecrets bool) resource.PropertyMap
MakeTerraformOutputs takes an expanded Terraform property map and returns a Pulumi equivalent. This respects the property maps so that results end up with their correct Pulumi names when shipping back to the engine.
func MakeTerraformResult ¶
func MakeTerraformResult(p shim.Provider, state shim.InstanceState, tfs shim.SchemaMap, ps map[string]*SchemaInfo, assets AssetTable, supportsSecrets bool) (resource.PropertyMap, error)
MakeTerraformResult expands a Terraform state into an expanded Pulumi resource property map. This respects the property maps so that results end up with their correct Pulumi names when shipping back to the engine.
func MakeTerraformState ¶
func MakeTerraformState(res Resource, id string, m resource.PropertyMap) (shim.InstanceState, error)
MakeTerraformState converts a Pulumi property bag into its Terraform equivalent. This requires flattening everything and serializing individual properties as strings. This is a little awkward, but it's how Terraform represents resource properties (schemas are simply sugar on top).
func MakeType
deprecated
added in
v3.12.0
func MarkSchemaSecrets ¶ added in v3.47.0
func MarkSchemaSecrets(ctx context.Context, schemaMap shim.SchemaMap, configInfos map[string]*SchemaInfo, pv resource.PropertyValue) resource.PropertyValue
Ensures resource.MakeSecret is used to wrap any nested values that correspond to secret properties in the schema. A property is considered secret if it is declared Sensitive in the SchemaMap in the upstream provider. Users may also override a matching SchemaInfo.Secret setting to force a property to be considered secret or non-secret.
func NewCheckFailure ¶ added in v3.49.0
func NewCheckFailure( reasonType CheckFailureReason, reason string, pp *CheckFailurePath, urn resource.URN, isProvider bool, configPrefix string, schemaMap shim.SchemaMap, schemaInfos map[string]*SchemaInfo, ) plugin.CheckFailure
Formats a CheckFailure to report an issue with a resource or provider configuration. This method is made public to facilitate cross-package use by the bridge framework and is not intended for use by provider authors.
func PulumiToTerraformName ¶
PulumiToTerraformName performs a standard transformation on the given name string, from Pulumi's PascalCasing or camelCasing, to Terraform's underscore_casing.
func Serve ¶
func Serve(module string, version string, info ProviderInfo, pulumiSchema []byte, options ...Option) error
Serve fires up a Pulumi resource provider listening to inbound gRPC traffic, and translates calls from Pulumi into actions against the provided Terraform Provider.
func StringValue ¶ added in v3.12.0
func StringValue(vars resource.PropertyMap, prop resource.PropertyKey) string
StringValue gets a string value from a property map if present, else ""
func TerraformToPulumiName
deprecated
TerraformToPulumiName performs a standard transformation on the given name string, from Terraform's underscore_casing to Pulumi's PascalCasing (if upper is true) or camelCasing (if upper is false).
Deprecated: Convert to TerraformToPulumiNameV2, see comment for conversion instructions.
TerraformToPulumiNameV2 includes enough information for a bijective mapping between Terraform attributes and Pulumi properties. If the full naming context cannot be acquired, you can construct a partial naming context:
TerraformToPulumiNameV2(name, schema.SchemaMap(map[string]shim.Schema{name: sch}), map[string]*SchemaInfo{name: ps})
If the previous (non-invertable) camel casing is necessary, it must be implemented manually:
name := TerraformToPulumiNameV2(key, sch, ps) name = strings(uniode.ToUpper(rune(name[0]))) + name[1:]
func TerraformToPulumiNameAtPath ¶ added in v3.48.0
func TerraformToPulumiNameAtPath( path walk.SchemaPath, sch shim.SchemaMap, ps map[string]*SchemaInfo, ) (string, error)
A helper method to perform TerraformToPulumiNameV2 translation at nested property positions easily. The path argument specifies the nested location of the current property within the schema; sch and ps arguments specify top-level resource, data source or provider SchemaMap and field SchemaInfo overrides. This method automatically finds the approproate nested SchemaMap and field overrides for the property and performs the name translation.
func TerraformToPulumiNameV2 ¶ added in v3.39.2
TerraformToPulumiNameV2 performs a standard transformation on the given name string, from Terraform's underscore_casing to Pulumi's camelCasing.
func TransformJSONDocument ¶
func TransformJSONDocument(v resource.PropertyValue) (resource.PropertyValue, error)
TransformJSONDocument permits either a string, which is presumed to represent an already-stringified JSON document, or a map/array, which will be transformed into its JSON representation.
func True ¶
func True() *bool
True is used for interations in the providers that require a pointer to true
func UnmarshalTerraformState ¶
func UnmarshalTerraformState(r Resource, id string, m *pbstruct.Struct, l string) (shim.InstanceState, error)
UnmarshalTerraformState unmarshals a Terraform instance state from an RPC property map.
Types ¶
type AliasInfo ¶
AliasInfo is a partial description of prior named used for a resource. It can be processed in the context of a resource creation to determine what the full aliased URN would be.
It can be used by Pulumi resource providers to change the aspects of it (i.e. what module it is contained in), without causing resources to be recreated for customers who migrate from the original resource to the current resource.
type AssetTable ¶
type AssetTable map[*SchemaInfo]resource.PropertyValue
AssetTable is used to record which properties in a call to MakeTerraformInputs were assets so that they can be marshaled back to assets by MakeTerraformOutputs.
func MakeTerraformConfig ¶
func MakeTerraformConfig(p *Provider, m resource.PropertyMap, tfs shim.SchemaMap, ps map[string]*SchemaInfo) (shim.ResourceConfig, AssetTable, error)
MakeTerraformConfig creates a Terraform config map, used in state and diff calculations, from a Pulumi property map.
func MakeTerraformInputs ¶
func MakeTerraformInputs(instance *PulumiResource, config resource.PropertyMap, olds, news resource.PropertyMap, tfs shim.SchemaMap, ps map[string]*SchemaInfo) (map[string]interface{}, AssetTable, error)
func UnmarshalTerraformConfig ¶
func UnmarshalTerraformConfig(p *Provider, m *pbstruct.Struct, tfs shim.SchemaMap, ps map[string]*SchemaInfo, label string) (shim.ResourceConfig, AssetTable, error)
UnmarshalTerraformConfig creates a Terraform config map from a Pulumi RPC property map.
type AssetTranslation ¶
type AssetTranslation struct { Kind AssetTranslationKind // the kind of translation to perform. Format resource.ArchiveFormat // an archive format, required if this is an archive. HashField string // a field to store the hash into, if any. }
AssetTranslation instructs the bridge how to translate assets into something Terraform can use.
func (*AssetTranslation) IsArchive ¶
func (a *AssetTranslation) IsArchive() bool
IsArchive returns true if the translation deals with an archive (rather than asset).
func (*AssetTranslation) IsAsset ¶
func (a *AssetTranslation) IsAsset() bool
IsAsset returns true if the translation deals with an asset (rather than archive).
func (*AssetTranslation) TranslateArchive ¶
func (a *AssetTranslation) TranslateArchive(archive *resource.Archive) (interface{}, error)
TranslateArchive translates the given archive using the directives provided by the translation info.
func (*AssetTranslation) TranslateAsset ¶
func (a *AssetTranslation) TranslateAsset(asset *resource.Asset) (interface{}, error)
TranslateAsset translates the given asset using the directives provided by the translation info.
func (*AssetTranslation) Type ¶
func (a *AssetTranslation) Type() string
Type fetches the Pulumi runtime type corresponding to values of this asset kind.
type AssetTranslationKind ¶
type AssetTranslationKind int
AssetTranslationKind may be used to choose from various source and dest translation targets.
const ( // FileAsset turns the asset into a file on disk and passes the filename in its place. FileAsset AssetTranslationKind = iota // BytesAsset turns the asset into a []byte and passes it directly in-memory. BytesAsset // FileArchive turns the archive into a file on disk and passes the filename in its place. FileArchive // BytesArchive turns the asset into a []byte and passes that directly in-memory. BytesArchive )
type AutoNameOptions ¶
type AutoNameOptions struct { // A separator between name and random portions of the Separator string // Maximum length of the generated name Maxlen int // Number of random characters to add to the name Randlen int // What characters to use for the random portion of the name, defaults to hex digits Charset []rune // A transform to apply to the name prior to adding random characters Transform func(string) string // A transform to apply after the auto naming has been computed PostTransform func(res *PulumiResource, name string) (string, error) }
AutoNameOptions provides parameters to AutoName to control how names will be generated
type CSharpInfo ¶
type CSharpInfo struct { PackageReferences map[string]string // NuGet package reference information. Overlay *OverlayInfo // optional overlay information for augmented code-generation. Namespaces map[string]string // Known .NET namespaces with proper capitalization. RootNamespace string // The root namespace if setting to something other than Pulumi in the package name }
CSharpInfo contains optional overlay information for C# code-generation.
type CheckFailurePath ¶ added in v3.49.0
type CheckFailurePath struct {
// contains filtered or unexported fields
}
Identifies a path to the property that is failing checks. See NewCheckFailure.
func NewCheckFailurePath ¶ added in v3.49.0
func NewCheckFailurePath(schemaMap shim.SchemaMap, schemaInfos map[string]*SchemaInfo, prop string) CheckFailurePath
func (CheckFailurePath) Attribute ¶ added in v3.49.0
func (p CheckFailurePath) Attribute(name string) CheckFailurePath
func (CheckFailurePath) ListElement ¶ added in v3.49.0
func (p CheckFailurePath) ListElement(n int64) CheckFailurePath
func (CheckFailurePath) MapElement ¶ added in v3.49.0
func (p CheckFailurePath) MapElement(s string) CheckFailurePath
func (CheckFailurePath) SetElement ¶ added in v3.49.0
func (p CheckFailurePath) SetElement() CheckFailurePath
type CheckFailureReason ¶ added in v3.49.0
type CheckFailureReason int64
Enumerates categories of failing checks. See NewCheckFailure.
const ( MiscFailure CheckFailureReason = 0 MissingKey CheckFailureReason = 1 InvalidKey CheckFailureReason = 2 )
type ConfigEncoding ¶ added in v3.47.0
type ConfigEncoding struct {
// contains filtered or unexported fields
}
func NewConfigEncoding ¶ added in v3.47.0
func NewConfigEncoding(config shim.SchemaMap, configInfos map[string]*SchemaInfo) *ConfigEncoding
func (*ConfigEncoding) MarshalProperties ¶ added in v3.47.0
func (enc *ConfigEncoding) MarshalProperties(props resource.PropertyMap) (*structpb.Struct, error)
Inverse of UnmarshalProperties, with additional support for secrets. Since the encoding cannot represent nested secrets, any nested secrets will be approximated by making the entire top-level property secret.
func (*ConfigEncoding) UnmarshalProperties ¶ added in v3.47.0
func (enc *ConfigEncoding) UnmarshalProperties(props *structpb.Struct) (resource.PropertyMap, error)
Inline from plugin.UnmarshalProperties substituting plugin.UnmarshalPropertyValue.
type ConfigInfo ¶
type ConfigInfo struct { // Info is the Pulumi schema for this variable. Info *SchemaInfo // Schema is the Terraform schema for this variable. Schema shim.Schema }
ConfigInfo represents a synthetic configuration variable that is Pulumi-only, and not passed to Terraform.
type DataSource ¶
type DataSource struct { Schema *DataSourceInfo // optional provider overrides. TF shim.Resource // the Terraform data source schema. TFName string // the Terraform resource name. }
DataSource wraps both the Terraform data source (resource) type info plus the overlay resource info.
type DataSourceInfo ¶
type DataSourceInfo struct { Tok tokens.ModuleMember Fields map[string]*SchemaInfo Docs *DocInfo // overrides for finding and mapping TF docs. DeprecationMessage string // message to use in deprecation warning }
DataSourceInfo can be used to override a data source's standard name mangling and argument/return information.
func (*DataSourceInfo) GetDocs ¶
func (info *DataSourceInfo) GetDocs() *DocInfo
GetDocs returns a datasource docs override from the Pulumi provider
func (*DataSourceInfo) GetFields ¶
func (info *DataSourceInfo) GetFields() map[string]*SchemaInfo
GetFields returns information about the datasource's custom fields
func (*DataSourceInfo) GetTok ¶
func (info *DataSourceInfo) GetTok() tokens.Token
GetTok returns a datasource type token
func (*DataSourceInfo) ReplaceExamplesSection ¶ added in v3.29.0
func (info *DataSourceInfo) ReplaceExamplesSection() bool
ReplaceExamplesSection returns whether to replace the upstream examples with our own source
type DefaultInfo ¶
type DefaultInfo struct { // AutoNamed is true if this default represents an autogenerated name. AutoNamed bool // Config uses a configuration variable from this package as the default value. Config string // From applies a transformation from other resource properties. From func(res *PulumiResource) (interface{}, error) // Value injects a raw literal value as the default. Value interface{} // EnvVars to use for defaults. If none of these variables have values at runtime, the value of `Value` (if any) // will be used as the default. EnvVars []string }
DefaultInfo lets fields get default values at runtime, before they are even passed to Terraform.
type DocInfo ¶
type DocInfo struct { Source string // an optional override to locate TF docs; "" uses the default. Markdown []byte // an optional override for the source markdown. IncludeAttributesFrom string // optionally include attributes from another raw resource for docs. IncludeArgumentsFrom string // optionally include arguments from another raw resource for docs. IncludeAttributesFromArguments string // optionally include attributes from another raw resource's arguments. ImportDetails string // Overwrite for import instructions // Replace examples with the contents of a specific document // this document will satisfy the criteria `docs/pulumiToken.md` // The examples need to wrapped in the correct shortcodes ReplaceExamplesSection bool }
DocInfo contains optional overrides for finding and mapping TF docs.
func (*DocInfo) GetImportDetails ¶ added in v3.21.0
GetImportDetails returns a string of import instructions defined in the Pulumi provider. Defaults to empty.
type DocRuleInfo ¶ added in v3.47.0
type DocRuleInfo struct { // The function called to get the set of edit rules to use. // // defaults represents suggested edit rules. If EditRules is `nil`, defaults is // used as is. EditRules MakeEditRules // A function to suggest alternative file names for a TF element. // // When the bridge loads the documentation for a resource or a datasource, it // infers the name of the file that contains the documentation. AlternativeNames // allows you to provide a provider specific extension to the override list. // // For example, when attempting to find the documentation for the resource token // aws_waf_instances, the bridge will check the following files (in order): // // "waf_instance.html.markdown" // "waf_instance.markdown" // "waf_instance.html.md" // "waf_instance.md" // "aws_waf_instance.html.markdown" // "aws_waf_instance.markdown" // "aws_waf_instance.html.md" // "aws_waf_instance.md" // // The bridge will check any file names returned by AlternativeNames before // checking it's standard list. AlternativeNames func(DocsPathInfo) []string }
DocRuleInfo controls file discovery and edits for any subset of docs in a provider.
type DocsEdit ¶ added in v3.47.0
type DocsEdit struct { // The file name at which this rule applies. File names are matched via filepath.Match. // // To match all files, supply "*". // // All 4 of these names will match "waf_instances.html.markdown": // // - "waf_instances.html.markdown" // - "waf_instances.*" // - "waf*" // - "*" // // Provider resources are sourced directly from the TF schema, and as such have an // empty path. Path string // The function that performs the edit on the file bytes. // // Must not be nil. Edit func(path string, content []byte) ([]byte, error) }
type DocsPathInfo ¶ added in v3.47.0
type DocsPathInfo struct {
TfToken string
}
Information for file lookup.
type GolangInfo ¶
type GolangInfo struct { GenerateResourceContainerTypes bool // Generate container types for resources e.g. arrays, maps, pointers etc. ImportBasePath string // Base import path for package. Overlay *OverlayInfo // optional overlay information for augmented code-generation. }
GolangInfo contains optional overlay information for Golang code-generation.
type HclExampler ¶ added in v3.20.0
type HclExampler interface { // GetToken returns the fully qualified path to the resource or function in the schema, e.g. // "provider:module/getFoo:getFoo" (function), or // "provider:module/bar:Bar" (resource) GetToken() string // GetMarkdown returns the Markdown that comprises the entire example, including the header. // // Headers should be an H3 ("###") and the header content should not contain any prefix, e.g. "Foo with Bar" not, // "Example Usage - Foo with Bar". // // Code should be surrounded with code fences with an indicator of the language on the opening fence, e.g. "“`hcl". GetMarkdown() (string, error) }
HclExampler represents a supplemental HCL example for a given resource or function.
type InlineHclExample ¶ added in v3.20.0
type InlineHclExample struct { // Token is the Pulumi identifier for the resource or function to which the example pertains, e.g. // "provider:module/getFoo:getFoo" (function), or // "provider:module/bar:Bar" (resource) Token string // Title is title of the example, e.g. "Basic Something", "Advanced Something with Something Else". Title string // Contents is the HCL that comprises the example with no surrounding Markdown constructs (e.g. “`hcl`). Contents string }
InlineHclExample represents a literal HCL example and is primarily used for testing the Bridge.
func (InlineHclExample) GetMarkdown ¶ added in v3.20.0
func (e InlineHclExample) GetMarkdown() (string, error)
func (InlineHclExample) GetToken ¶ added in v3.20.0
func (e InlineHclExample) GetToken() string
type JavaInfo ¶ added in v3.24.0
type JavaInfo struct { BasePackage string // the Base package for the Java SDK // If set to "gradle" enables a generation of a basic set of // Gradle build files. BuildFiles string // If non-empty and BuildFiles="gradle", enables the use of a // given version of io.github.gradle-nexus.publish-plugin in // the generated Gradle build files. GradleNexusPublishPluginVersion string }
type JavaScriptInfo ¶
type JavaScriptInfo struct { PackageName string // Custom name for the NPM package. Dependencies map[string]string // NPM dependencies to add to package.json. DevDependencies map[string]string // NPM dev-dependencies to add to package.json. PeerDependencies map[string]string // NPM peer-dependencies to add to package.json. Resolutions map[string]string // NPM resolutions to add to package.json. Overlay *OverlayInfo // optional overlay information for augmented code-generation. TypeScriptVersion string // A specific version of TypeScript to include in package.json. }
JavaScriptInfo contains optional overlay information for Python code-generation.
type LocalFileHclExample ¶ added in v3.20.0
type LocalFileHclExample struct { // Token is the Pulumi identifier for the resource or function to which the example pertains, e.g. // "provider:module/getFoo:getFoo" (function), or // "provider:module/bar:Bar" (resource) Token string // Title is title of the example, e.g. "Basic Something", "Advanced Something with Something Else". Title string // RelativePath is the path to the file in the Pulumi repo relative to the repo root. RelativePath string }
LocalFileHclExample represents a supplemental HCL example that is on a relative path within the Pulumi provider repo.
func (LocalFileHclExample) GetMarkdown ¶ added in v3.20.0
func (e LocalFileHclExample) GetMarkdown() (string, error)
func (LocalFileHclExample) GetToken ¶ added in v3.20.0
func (e LocalFileHclExample) GetToken() string
type LogRedirector ¶
type LogRedirector struct {
// contains filtered or unexported fields
}
LogRedirector creates a new redirection writer that takes as input plugin stderr output, and routes it to the correct Pulumi stream based on the standard Terraform logging output prefixes.
func NewTerraformLogRedirector ¶
func NewTerraformLogRedirector(ctx context.Context, hostClient *provider.HostClient) *LogRedirector
NewLogRedirector returns a new LogRedirector with the (unexported) writers field set to the given map.
func (*LogRedirector) Disable ¶
func (lr *LogRedirector) Disable()
Disable disables most of the specific logging levels, but it retains debug logging.
func (*LogRedirector) Enable ¶
func (lr *LogRedirector) Enable()
Enable turns on full featured logging. This is the default.
type MakeEditRules ¶ added in v3.47.0
The function used to produce the set of edit rules for a provider.
For example, if you want to skip default edits, you would use the function:
func([]DocsEdit) []DocsEdit { return nil }
If you wanted to incorporate custom edits, default edits, and then a check that the resulting document is valid, you would use the function:
func(defaults []DocsEdit) []DocsEdit { return append(customEdits, append(defaults, validityCheck)...) }
type MarshallableDataSourceInfo ¶
type MarshallableDataSourceInfo struct { Tok tokens.ModuleMember `json:"tok"` Fields map[string]*MarshallableSchemaInfo `json:"fields"` }
MarshallableDataSourceInfo is the JSON-marshallable form of a Pulumi DataSourceInfo value.
func MarshalDataSourceInfo ¶
func MarshalDataSourceInfo(d *DataSourceInfo) *MarshallableDataSourceInfo
MarshalDataSourceInfo converts a Pulumi DataSourceInfo value into a MarshallableDataSourceInfo value.
func (*MarshallableDataSourceInfo) Unmarshal ¶
func (m *MarshallableDataSourceInfo) Unmarshal() *DataSourceInfo
Unmarshal creates a mostly-=initialized Pulumi DataSourceInfo value from the given MarshallableDataSourceInfo.
type MarshallableDefaultInfo ¶
type MarshallableDefaultInfo struct { AutoNamed bool `json:"autonamed,omitempty"` IsFunc bool `json:"isFunc,omitempty"` Value interface{} `json:"value,omitempty"` EnvVars []string `json:"envvars,omitempty"` }
MarshallableDefaultInfo is the JSON-marshallable form of a Pulumi DefaultInfo value.
func MarshalDefaultInfo ¶
func MarshalDefaultInfo(d *DefaultInfo) *MarshallableDefaultInfo
MarshalDefaultInfo converts a Pulumi DefaultInfo value into a MarshallableDefaultInfo value.
func (*MarshallableDefaultInfo) Unmarshal ¶
func (m *MarshallableDefaultInfo) Unmarshal() *DefaultInfo
Unmarshal creates a mostly-initialized Pulumi DefaultInfo value from the given MarshallableDefaultInfo.
type MarshallableElem ¶
type MarshallableElem struct { Schema *MarshallableSchema `json:"schema,omitempty"` Resource MarshallableResource `json:"resource,omitempty"` }
MarshallableElem is the JSON-marshallable form of a Terraform schema's element field.
func MarshalElem ¶
func MarshalElem(e interface{}) *MarshallableElem
MarshalElem converts a Terraform schema's element field into a MarshallableElem.
func (*MarshallableElem) Unmarshal ¶
func (m *MarshallableElem) Unmarshal() interface{}
Unmarshal creates a Terraform schema element from a MarshallableElem.
type MarshallableProvider ¶
type MarshallableProvider struct { Schema map[string]*MarshallableSchema `json:"schema,omitempty"` Resources map[string]MarshallableResource `json:"resources,omitempty"` DataSources map[string]MarshallableResource `json:"dataSources,omitempty"` }
MarshallableProvider is the JSON-marshallable form of a Terraform provider schema.
func MarshalProvider ¶
func MarshalProvider(p shim.Provider) *MarshallableProvider
MarshalProvider converts a Terraform provider schema into a MarshallableProvider.
func (*MarshallableProvider) Unmarshal ¶
func (m *MarshallableProvider) Unmarshal() shim.Provider
Unmarshal creates a mostly-initialized Terraform provider schema from a MarshallableProvider
type MarshallableProviderInfo ¶
type MarshallableProviderInfo struct { Provider *MarshallableProvider `json:"provider"` Name string `json:"name"` Version string `json:"version"` Config map[string]*MarshallableSchemaInfo `json:"config,omitempty"` Resources map[string]*MarshallableResourceInfo `json:"resources,omitempty"` DataSources map[string]*MarshallableDataSourceInfo `json:"dataSources,omitempty"` TFProviderVersion string `json:"tfProviderVersion,omitempty"` }
MarshallableProviderInfo is the JSON-marshallable form of a Pulumi ProviderInfo value.
func MarshalProviderInfo ¶
func MarshalProviderInfo(p *ProviderInfo) *MarshallableProviderInfo
MarshalProviderInfo converts a Pulumi ProviderInfo value into a MarshallableProviderInfo value.
func (*MarshallableProviderInfo) Unmarshal ¶
func (m *MarshallableProviderInfo) Unmarshal() *ProviderInfo
Unmarshal creates a mostly-=initialized Pulumi ProviderInfo value from the given MarshallableProviderInfo.
type MarshallableResource ¶
type MarshallableResource map[string]*MarshallableSchema
MarshallableResource is the JSON-marshallable form of a Terraform resource schema.
func MarshalResource ¶
func MarshalResource(r shim.Resource) MarshallableResource
MarshalResource converts a Terraform resource schema into a MarshallableResource.
func (MarshallableResource) Unmarshal ¶
func (m MarshallableResource) Unmarshal() shim.Resource
Unmarshal creates a mostly-initialized Terraform resource schema from the given MarshallableResource.
type MarshallableResourceInfo ¶
type MarshallableResourceInfo struct { Tok tokens.Type `json:"tok"` Fields map[string]*MarshallableSchemaInfo `json:"fields"` // Deprecated: IDFields is not currently used and will be deprecated in the next major version of // pulumi-terraform-bridge. IDFields []string `json:"idFields"` }
MarshallableResourceInfo is the JSON-marshallable form of a Pulumi ResourceInfo value.
func MarshalResourceInfo ¶
func MarshalResourceInfo(r *ResourceInfo) *MarshallableResourceInfo
MarshalResourceInfo converts a Pulumi ResourceInfo value into a MarshallableResourceInfo value.
func (*MarshallableResourceInfo) Unmarshal ¶
func (m *MarshallableResourceInfo) Unmarshal() *ResourceInfo
Unmarshal creates a mostly-=initialized Pulumi ResourceInfo value from the given MarshallableResourceInfo.
type MarshallableSchema ¶
type MarshallableSchema struct { Type shim.ValueType `json:"type"` Optional bool `json:"optional,omitempty"` Required bool `json:"required,omitempty"` Computed bool `json:"computed,omitempty"` ForceNew bool `json:"forceNew,omitempty"` Elem *MarshallableElem `json:"element,omitempty"` MaxItems int `json:"maxItems,omitempty"` MinItems int `json:"minItems,omitempty"` DeprecationMessage string `json:"deprecated,omitempty"` }
MarshallableSchema is the JSON-marshallable form of a Terraform schema.
func MarshalSchema ¶
func MarshalSchema(s shim.Schema) *MarshallableSchema
MarshalSchema converts a Terraform schema into a MarshallableSchema.
func (*MarshallableSchema) Unmarshal ¶
func (m *MarshallableSchema) Unmarshal() shim.Schema
Unmarshal creates a mostly-initialized Terraform schema from the given MarshallableSchema.
type MarshallableSchemaInfo ¶
type MarshallableSchemaInfo struct { Name string `json:"name,omitempty"` CSharpName string `json:"csharpName,omitempty"` Type tokens.Type `json:"typeomitempty"` AltTypes []tokens.Type `json:"altTypes,omitempty"` Elem *MarshallableSchemaInfo `json:"element,omitempty"` Fields map[string]*MarshallableSchemaInfo `json:"fields,omitempty"` Asset *AssetTranslation `json:"asset,omitempty"` Default *MarshallableDefaultInfo `json:"default,omitempty"` MaxItemsOne *bool `json:"maxItemsOne,omitempty"` Deprecated string `json:"deprecated,omitempty"` ForceNew *bool `json:"forceNew,omitempty"` Secret *bool `json:"secret,omitempty"` }
MarshallableSchemaInfo is the JSON-marshallable form of a Pulumi SchemaInfo value.
func MarshalSchemaInfo ¶
func MarshalSchemaInfo(s *SchemaInfo) *MarshallableSchemaInfo
MarshalSchemaInfo converts a Pulumi SchemaInfo value into a MarshallableSchemaInfo value.
func (*MarshallableSchemaInfo) Unmarshal ¶
func (m *MarshallableSchemaInfo) Unmarshal() *SchemaInfo
Unmarshal creates a mostly-=initialized Pulumi SchemaInfo value from the given MarshallableSchemaInfo.
type MetadataInfo ¶ added in v3.43.0
type MetadataInfo struct { // The path (relative to schema.json) of the metadata file. Path string // The parsed metadata. Data ProviderMetadata }
Information necessary to persist and use provider level metadata.
func NewProviderMetadata ¶ added in v3.43.0
func NewProviderMetadata(bytes []byte) *MetadataInfo
Describe a metadata file called `bridge-metadata.json`.
`bytes` is the embedded metadata file.
type Option ¶ added in v3.44.0
type Option func(*opts)
func MuxWith ¶ added in v3.44.0
func MuxWith(s func(*provider.HostClient) (pulumirpc.ResourceProviderServer, error)) Option
This is an experimental API.
type OverlayInfo ¶
type OverlayInfo struct { DestFiles []string // Additional files to include in the index file. Must exist in the destination. Modules map[string]*OverlayInfo // extra modules to inject into the structure. }
OverlayInfo contains optional overlay information. Each info has a 1:1 correspondence with a module and permits extra files to be included from the overlays/ directory when building up packs/. This allows augmented code-generation for convenient things like helper functions, modules, and gradual typing.
type PreConfigureCallback ¶
type PreConfigureCallback func(vars resource.PropertyMap, config shim.ResourceConfig) error
PreConfigureCallback is a function to invoke prior to calling the TF provider Configure
type PreConfigureCallbackWithLogger ¶ added in v3.30.0
type PreConfigureCallbackWithLogger func( ctx context.Context, host *provider.HostClient, vars resource.PropertyMap, config shim.ResourceConfig, ) error
PreConfigureCallbackWithLogger is a function to invoke prior to calling the T
type PreStateUpgradeHook ¶ added in v3.42.0
type PreStateUpgradeHook = func(PreStateUpgradeHookArgs) (int64, resource.PropertyMap, error)
If specified, the hook will run just prior to executing Terraform state upgrades to transform the resource state as stored in Pulumi. It can be used to perform idempotent corrections on corrupt state and to compensate for Terraform-level state upgrade not working as expected. Returns the corrected resource state and version. To be used with care.
See also: https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource/schema#Schema.Version
type PreStateUpgradeHookArgs ¶ added in v3.42.0
type PreStateUpgradeHookArgs struct { PriorState resource.PropertyMap PriorStateSchemaVersion int64 ResourceSchemaVersion int64 }
type Provider ¶
type Provider struct { pulumirpc.UnimplementedResourceProviderServer // contains filtered or unexported fields }
Provider implements the Pulumi resource provider operations for any Terraform plugin.
func NewProvider ¶
func NewProvider(ctx context.Context, host *provider.HostClient, module string, version string, tf shim.Provider, info ProviderInfo, pulumiSchema []byte) *Provider
NewProvider creates a new Pulumi RPC server wired up to the given host and wrapping the given Terraform provider.
func (*Provider) Call ¶ added in v3.4.0
func (p *Provider) Call(ctx context.Context, req *pulumirpc.CallRequest) (*pulumirpc.CallResponse, error)
Call dynamically executes a method in the provider associated with a component resource.
func (*Provider) Cancel ¶
Cancel requests that the provider cancel all ongoing RPCs. For TF, this is a no-op.
func (*Provider) Check ¶
func (p *Provider) Check(ctx context.Context, req *pulumirpc.CheckRequest) (*pulumirpc.CheckResponse, error)
Check validates that the given property bag is valid for a resource of the given type.
func (*Provider) CheckConfig ¶
func (p *Provider) CheckConfig(ctx context.Context, req *pulumirpc.CheckRequest) (*pulumirpc.CheckResponse, error)
CheckConfig validates the configuration for this Terraform provider.
func (*Provider) Configure ¶
func (p *Provider) Configure(ctx context.Context, req *pulumirpc.ConfigureRequest) (*pulumirpc.ConfigureResponse, error)
Configure configures the underlying Terraform provider with the live Pulumi variable state.
NOTE that validation and calling PreConfigureCallbacks are not called here but are called in CheckConfig. Pulumi will always call CheckConfig first and call Configure with validated (or extended) results of CheckConfig.
func (*Provider) Construct ¶
func (p *Provider) Construct(context.Context, *pulumirpc.ConstructRequest) (*pulumirpc.ConstructResponse, error)
Construct creates a new instance of the provided component resource and returns its state.
func (*Provider) Create ¶
func (p *Provider) Create(ctx context.Context, req *pulumirpc.CreateRequest) (*pulumirpc.CreateResponse, error)
Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID must be blank.) If this call fails, the resource must not have been created (i.e., it is "transactional").
func (*Provider) Delete ¶
func (p *Provider) Delete(ctx context.Context, req *pulumirpc.DeleteRequest) (*pbempty.Empty, error)
Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (*Provider) Diff ¶
func (p *Provider) Diff(ctx context.Context, req *pulumirpc.DiffRequest) (*pulumirpc.DiffResponse, error)
Diff checks what impacts a hypothetical update will have on the resource's properties.
func (*Provider) DiffConfig ¶
func (p *Provider) DiffConfig(ctx context.Context, req *pulumirpc.DiffRequest) (*pulumirpc.DiffResponse, error)
DiffConfig diffs the configuration for this Terraform provider.
func (*Provider) GetMapping ¶ added in v3.34.0
func (p *Provider) GetMapping( ctx context.Context, req *pulumirpc.GetMappingRequest) (*pulumirpc.GetMappingResponse, error)
func (*Provider) GetPluginInfo ¶
func (p *Provider) GetPluginInfo(ctx context.Context, req *pbempty.Empty) (*pulumirpc.PluginInfo, error)
GetPluginInfo implements an RPC call that returns the version of this plugin.
func (*Provider) GetSchema ¶
func (p *Provider) GetSchema(ctx context.Context, req *pulumirpc.GetSchemaRequest) (*pulumirpc.GetSchemaResponse, error)
GetSchema returns the JSON-encoded schema for this provider's package.
func (*Provider) Invoke ¶
func (p *Provider) Invoke(ctx context.Context, req *pulumirpc.InvokeRequest) (*pulumirpc.InvokeResponse, error)
Invoke dynamically executes a built-in function in the provider.
func (*Provider) Read ¶
func (p *Provider) Read(ctx context.Context, req *pulumirpc.ReadRequest) (*pulumirpc.ReadResponse, error)
Read the current live state associated with a resource. Enough state must be include in the inputs to uniquely identify the resource; this is typically just the resource ID, but may also include some properties.
func (*Provider) StreamInvoke ¶
func (p *Provider) StreamInvoke( req *pulumirpc.InvokeRequest, server pulumirpc.ResourceProvider_StreamInvokeServer) error
StreamInvoke dynamically executes a built-in function in the provider. The result is streamed back as a series of messages.
func (*Provider) Update ¶
func (p *Provider) Update(ctx context.Context, req *pulumirpc.UpdateRequest) (*pulumirpc.UpdateResponse, error)
Update updates an existing resource with new values. Only those values in the provided property bag are updated to new values. The resource ID is returned and may be different if the resource had to be recreated.
type ProviderInfo ¶
type ProviderInfo struct { P shim.Provider // the TF provider/schema. Name string // the TF provider name (e.g. terraform-provider-XXXX). ResourcePrefix string // the prefix on resources the provider exposes, if different to `Name`. // GitHubOrg is the segment of the upstream provider's Go module path that comes after GitHubHost and before // terraform-provider-${Name}. Defaults to `terraform-providers`. // // Note that this value should match the require directive for the upstream provider, not any replace directives. // // For example, GitHubOrg should be set to "my-company" given the following go.mod: // // require github.com/my-company/terraform-repo-example v1.0.0 // replace github.com/my-company/terraform-repo-example => github.com/some-fork/terraform-repo-example v1.0.0 GitHubOrg string // the GitHub org of the provider. Defaults to `terraform-providers`. GitHubHost string // the GitHub host for the provider. Defaults to `github.com`. Description string // an optional descriptive overview of the package (a default supplied). Keywords []string // an optional list of keywords to help discovery of this package. e.g. "category/cloud, category/infrastructure" License string // the license, if any, the resulting package has (default is none). LogoURL string // an optional URL to the logo of the package DisplayName string // the human friendly name of the package used in the Pulumi registry Publisher string // the name of the person or organization that authored and published the package. Homepage string // the URL to the project homepage. Repository string // the URL to the project source code repository. Version string // the version of the provider package. Config map[string]*SchemaInfo // a map of TF name to config schema overrides. ExtraConfig map[string]*ConfigInfo // a list of Pulumi-only configuration variables. Resources map[string]*ResourceInfo // a map of TF name to Pulumi name; standard mangling occurs if no entry. DataSources map[string]*DataSourceInfo // a map of TF name to Pulumi resource info. ExtraTypes map[string]pschema.ComplexTypeSpec // a map of Pulumi token to schema type for extra types. ExtraResources map[string]pschema.ResourceSpec // a map of Pulumi token to schema type for extra resources. ExtraFunctions map[string]pschema.FunctionSpec // a map of Pulumi token to schema type for extra functions. // ExtraResourceHclExamples is a slice of additional HCL examples attached to resources which are converted to the // relevant target language(s) ExtraResourceHclExamples []HclExampler // ExtraFunctionHclExamples is a slice of additional HCL examples attached to functions which are converted to the // relevant target language(s) ExtraFunctionHclExamples []HclExampler IgnoreMappings []string // a list of TF resources and data sources to ignore in mappings errors PluginDownloadURL string // an optional URL to download the provider binary from. JavaScript *JavaScriptInfo // optional overlay information for augmented JavaScript code-generation. Python *PythonInfo // optional overlay information for augmented Python code-generation. Golang *GolangInfo // optional overlay information for augmented Golang code-generation. CSharp *CSharpInfo // optional overlay information for augmented C# code-generation. Java *JavaInfo // optional overlay information for augmented C# code-generation. TFProviderVersion string // the version of the TF provider on which this was based TFProviderLicense *TFProviderLicense // license that the TF provider is distributed under. Default `MPL 2.0`. TFProviderModuleVersion string // the Go module version of the provider. Default is unversioned e.g. v1 PreConfigureCallback PreConfigureCallback // a provider-specific callback to invoke prior to TF Configure PreConfigureCallbackWithLogger PreConfigureCallbackWithLogger // Information for the embedded metadata file. // // See NewProviderMetadata for in-place construction of a *MetadataInfo. MetadataInfo *MetadataInfo // Rules that control file discovery and edits for any subset of docs in a provider. DocRules *DocRuleInfo UpstreamRepoPath string // An optional path that overrides upstream location during docs lookup // EXPERIMENTAL: the signature may change in minor releases. // // If set, allows selecting individual examples to skip generating into the PackageSchema (and eventually API // docs). The primary use case for this hook is to ignore problematic or flaky examples temporarily until the // underlying issues are resolved and the examples can be rendered correctly. SkipExamples func(SkipExamplesArgs) bool }
ProviderInfo contains information about a Terraform provider plugin that we will use to generate the Pulumi metadata. It primarily contains a pointer to the Terraform schema, but can also contain specific name translations.
func (*ProviderInfo) GetConfig ¶ added in v3.47.4
func (info *ProviderInfo) GetConfig() map[string]*SchemaInfo
func (ProviderInfo) GetGitHubHost ¶
func (info ProviderInfo) GetGitHubHost() string
func (ProviderInfo) GetGitHubOrg ¶
func (info ProviderInfo) GetGitHubOrg() string
func (ProviderInfo) GetMetadata ¶ added in v3.43.0
func (info ProviderInfo) GetMetadata() ProviderMetadata
func (ProviderInfo) GetProviderModuleVersion ¶
func (info ProviderInfo) GetProviderModuleVersion() string
func (ProviderInfo) GetResourcePrefix ¶
func (info ProviderInfo) GetResourcePrefix() string
GetResourcePrefix returns the resource prefix for the provider: info.ResourcePrefix if that is set, or info.Name if not. This is to avoid unexpected behaviour with providers which have no need to set ResourcePrefix following its introduction.
func (ProviderInfo) GetTFProviderLicense ¶
func (info ProviderInfo) GetTFProviderLicense() TFProviderLicense
func (*ProviderInfo) RenameDataSource ¶
func (p *ProviderInfo) RenameDataSource(resourceName string, legacyTok tokens.ModuleMember, newTok tokens.ModuleMember, legacyModule string, newModule string, info *DataSourceInfo)
func (*ProviderInfo) RenameResourceWithAlias ¶
func (p *ProviderInfo) RenameResourceWithAlias(resourceName string, legacyTok tokens.Type, newTok tokens.Type, legacyModule string, newModule string, info *ResourceInfo)
func (*ProviderInfo) SetAutonaming ¶
func (p *ProviderInfo) SetAutonaming(maxLength int, separator string)
SetAutonaming will loop all resources with a name property, and will add an auto-name property. It will skip those that already have a name mapping entry, since those may have custom overrides set in the resource declaration (e.g., for length).
type ProviderMetadata ¶ added in v3.43.0
A KV store persisted between `tfgen` and a running provider.
The store is read-write when the schema is being generated, and is persisted to disk with schema.json. During normal provider operation (pulumi-resource-${PKG}), the store if not persisted (making it effectively read-only).
type PulumiResource ¶
type PulumiResource struct { URN resource.URN Properties resource.PropertyMap Seed []byte }
PulumiResource is just a little bundle that carries URN, seed and properties around.
type PythonInfo ¶
type PythonInfo struct { Requires map[string]string // Pip install_requires information. Overlay *OverlayInfo // optional overlay information for augmented code-generation. UsesIOClasses bool // Deprecated: No longer required, all providers use IO classes. PackageName string // Name of the Python package to generate }
PythonInfo contains optional overlay information for Python code-generation.
type Resource ¶
type Resource struct { Schema *ResourceInfo // optional provider overrides. TF shim.Resource // the Terraform resource schema. TFName string // the Terraform resource name. }
Resource wraps both the Terraform resource type info plus the overlay resource info.
type ResourceInfo ¶
type ResourceInfo struct { Tok tokens.Type // a type token to override the default; "" uses the default. Fields map[string]*SchemaInfo // a map of custom field names; if a type is missing, uses the default. // Deprecated: IDFields is not currently used and will be removed in the next major version of // pulumi-terraform-bridge. IDFields []string // list of parameters that we can trust that any change will allow a createBeforeDelete UniqueNameFields []string Docs *DocInfo // overrides for finding and mapping TF docs. DeleteBeforeReplace bool // if true, Pulumi will delete before creating new replacement resources. Aliases []AliasInfo // aliases for this resources, if any. DeprecationMessage string // message to use in deprecation warning CSharpName string // .NET-specific name // Optional hook to run before upgrading the state. TODO[pulumi/pulumi-terraform-bridge#864] this is currently // only supported for Plugin-Framework based providers. PreStateUpgradeHook PreStateUpgradeHook }
ResourceInfo is a top-level type exported by a provider. This structure can override the type to generate. It can also give custom metadata for fields, using the SchemaInfo structure below. Finally, a set of composite keys can be given; this is used when Terraform needs more than just the ID to uniquely identify and query for a resource.
func (*ResourceInfo) GetDocs ¶
func (info *ResourceInfo) GetDocs() *DocInfo
GetDocs returns a resource docs override from the Pulumi provider
func (*ResourceInfo) GetFields ¶
func (info *ResourceInfo) GetFields() map[string]*SchemaInfo
GetFields returns information about the resource's custom fields
func (*ResourceInfo) GetTok ¶
func (info *ResourceInfo) GetTok() tokens.Token
GetTok returns a resource type token
func (*ResourceInfo) ReplaceExamplesSection ¶ added in v3.29.0
func (info *ResourceInfo) ReplaceExamplesSection() bool
ReplaceExamplesSection returns whether to replace the upstream examples with our own source
type ResourceOrDataSourceInfo ¶
type ResourceOrDataSourceInfo interface { GetTok() tokens.Token // a type token to override the default; "" uses the default. GetFields() map[string]*SchemaInfo // a map of custom field names; if a type is missing, uses the default. GetDocs() *DocInfo // overrides for finding and mapping TF docs. ReplaceExamplesSection() bool // whether we are replacing the upstream TF examples generation }
ResourceOrDataSourceInfo is a shared interface to ResourceInfo and DataSourceInfo mappings
type SchemaInfo ¶
type SchemaInfo struct { // a name to override the default; "" uses the default. Name string // a name to override the default when targeting C#; "" uses the default. CSharpName string // a type to override the default; "" uses the default. Type tokens.Type // alternative types that can be used instead of the override. AltTypes []tokens.Type // a type to override when the property is a nested structure. NestedType tokens.Type // an optional idemponent transformation, applied before passing to TF. Transform Transformer // a schema override for elements for arrays, maps, and sets. Elem *SchemaInfo // a map of custom field names; if a type is missing, the default is used. Fields map[string]*SchemaInfo // a map of asset translation information, if this is an asset. Asset *AssetTranslation // an optional default directive to be applied if a value is missing. Default *DefaultInfo // to override whether a property is stable or not. Stable *bool // to override whether this property should project as a scalar or array. MaxItemsOne *bool // to remove empty object array elements SuppressEmptyMapElements *bool // this will make the parameter as computed and not allow the user to set it MarkAsComputedOnly *bool // this will make the parameter optional in the schema MarkAsOptional *bool // the deprecation message for the property DeprecationMessage string // whether a change in the configuration would force a new resource ForceNew *bool // whether or not this property has been removed from the Terraform schema Removed bool // if set, this property will not be added to the schema and no bindings will be generated for it Omit bool // whether or not to treat this property as secret Secret *bool }
SchemaInfo contains optional name transformations to apply.
func AutoName ¶
func AutoName(name string, maxlength int, separator string) *SchemaInfo
AutoName creates custom schema for a Terraform name property which is automatically populated from the resource's URN name, and transformed based on the provided options.
func AutoNameTransform ¶
func AutoNameTransform(name string, maxlen int, transform func(string) string) *SchemaInfo
AutoNameTransform creates custom schema for a Terraform name property which is automatically populated from the resource's URN name, with an 8 character random suffix ("-"+7 random chars), maximum length maxlen, and optional transformation function. This makes it easy to propagate the Pulumi resource's URN name part as the Terraform name as a convenient default, while still permitting it to be overridden.
func AutoNameWithCustomOptions ¶
func AutoNameWithCustomOptions(name string, options AutoNameOptions) *SchemaInfo
AutoNameWithCustomOptions creates a custom schema for a Terraform name property and allows setting options to allow transforms, custom separators and maxLength combinations.
func LookupSchemaInfoMapPath ¶ added in v3.47.0
func LookupSchemaInfoMapPath( schemaPath SchemaPath, schemaInfos map[string]*SchemaInfo, ) *SchemaInfo
Drill down a path from a map of SchemaInfo objects and find a matching SchemaInfo if any.
func LookupSchemaInfoPath ¶ added in v3.47.0
func LookupSchemaInfoPath(schemaPath SchemaPath, schemaInfo *SchemaInfo) *SchemaInfo
Drill down a path from a SchemaInfo object and find a matching SchemaInfo if any.
func LookupSchemas ¶ added in v3.47.0
func LookupSchemas(schemaPath walk.SchemaPath, schemaMap shim.SchemaMap, schemaInfos map[string]*SchemaInfo) (shim.Schema, *SchemaInfo, error)
Convenience method to lookup both a Schema and a SchemaInfo by path.
func (SchemaInfo) HasDefault ¶
func (info SchemaInfo) HasDefault() bool
HasDefault returns true if there is a default value for this property.
type SchemaPath ¶ added in v3.47.0
type SchemaPath = walk.SchemaPath
func PropertyPathToSchemaPath ¶ added in v3.47.0
func PropertyPathToSchemaPath( propertyPath resource.PropertyPath, schemaMap shim.SchemaMap, schemaInfos map[string]*SchemaInfo) SchemaPath
Translate a Pulumi property path to a bridged provider schema path.
The function hides the complexity of mapping Pulumi property names to Terraform names, joining Schema with user overrides in SchemaInfos, and accounting for MaxItems=1 situations where Pulumi flattens collections to plain values. and therefore SchemaPath values are longer than the PropertyPath values.
PropertyPathToSchemaPath may return nil if there is no matching schema found. This may happen when drilling down to values of unknown type, attributes not tracked in schema, or when there is a type mismatch between the path and the schema.
type SkipExamplesArgs ¶ added in v3.45.0
type SkipExamplesArgs struct { // token will be a resource, function, or type token from Pulumi Package Schema. For instance, // "aws:acm/certificate:Certificate" would indicate the example pertains to the Certificate resource in the AWS // provider. Token string // examplePath will provide even more information on where the example is found. For instance, // "#/resources/aws:acm/certificate:Certificate/arn" would encode that the example pertains to the arn property // of the Certificate resource in the AWS provider. ExamplePath string }
EXPERIMENTAL: the signature may change in minor releases.
type TFProviderLicense ¶
type TFProviderLicense string
TFProviderLicense is a way to be able to pass a license type for the upstream Terraform provider.
const ( MPL20LicenseType TFProviderLicense = "MPL 2.0" MITLicenseType TFProviderLicense = "MIT" Apache20LicenseType TFProviderLicense = "Apache 2.0" UnlicensedLicenseType TFProviderLicense = "UNLICENSED" )
func SetProviderLicense ¶
func SetProviderLicense(license TFProviderLicense) *TFProviderLicense
SetProviderLicense is used to pass a license type to a provider metadata
type Transformer ¶
type Transformer func(resource.PropertyValue) (resource.PropertyValue, error)
Transformer is given the option to transform a value in situ before it is processed by the bridge. This transformation must be deterministic and idempotent, and any value produced by this transformation must be a legal alternative input value. A good example is a resource that accepts either a string or JSON-stringable map; a resource provider may opt to store the raw string, but let users pass in maps as a convenience mechanism, and have the transformer stringify them on the fly. This is safe to do because the raw string is still accepted as a possible input value.