Documentation ¶
Overview ¶
Converts between Pulumi and Terraform value representations. Conversions are type-driven and require to know Terraform types since Terraform values must be tagged with their corresponding types. Pulumi type metadata is also required to make finer grained distinctions such as int vs float, and to correctly handle object properties that have Pulumi names that differ from their Terraform names.
Index ¶
- func DecodePropertyMap(dec Decoder, v tftypes.Value) (resource.PropertyMap, error)
- func DecodePropertyMapFromDynamic(dec Decoder, objectType tftypes.Object, dv *tfprotov6.DynamicValue) (resource.PropertyMap, error)
- func EncodePropertyMap(enc Encoder, pmap resource.PropertyMap) (tftypes.Value, error)
- func EncodePropertyMapToDynamic(enc Encoder, objectType tftypes.Object, pmap resource.PropertyMap) (*tfprotov6.DynamicValue, error)
- type Decoder
- type Encoder
- type Encoding
- type LocalPropertyNames
- type PackageSpec
- type PropertyNames
- type TerraformPropertyName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePropertyMap ¶
func DecodePropertyMapFromDynamic ¶
func DecodePropertyMapFromDynamic(dec Decoder, objectType tftypes.Object, dv *tfprotov6.DynamicValue) (resource.PropertyMap, error)
func EncodePropertyMap ¶
func EncodePropertyMapToDynamic ¶
func EncodePropertyMapToDynamic(enc Encoder, objectType tftypes.Object, pmap resource.PropertyMap) (*tfprotov6.DynamicValue, error)
Types ¶
type Decoder ¶
type Decoder interface {
ToPropertyValue(tftypes.Value) (resource.PropertyValue, error)
}
type Encoder ¶
type Encoder interface {
FromPropertyValue(resource.PropertyValue) (tftypes.Value, error)
}
type Encoding ¶
type Encoding interface { NewConfigEncoder(tftypes.Object) (Encoder, error) NewResourceDecoder(tokens.Type, tftypes.Object) (Decoder, error) NewResourceEncoder(tokens.Type, tftypes.Object) (Encoder, error) NewDataSourceDecoder(tokens.ModuleMember, tftypes.Object) (Decoder, error) NewDataSourceEncoder(tokens.ModuleMember, tftypes.Object) (Encoder, error) }
func NewEncoding ¶
func NewEncoding(spec PackageSpec, propertyNames PropertyNames) Encoding
type LocalPropertyNames ¶
type LocalPropertyNames interface {
PropertyKey(property TerraformPropertyName, t tftypes.Type) resource.PropertyKey
}
Like PropertyNames but specialized to either a type by token or config property.
func NewConfigPropertyNames ¶
func NewConfigPropertyNames(pn PropertyNames) LocalPropertyNames
func NewTypeLocalPropertyNames ¶
func NewTypeLocalPropertyNames(pn PropertyNames, tok tokens.Token) LocalPropertyNames
type PackageSpec ¶
type PackageSpec interface { Config() *pschema.ConfigSpec Function(tok tokens.ModuleMember) *pschema.FunctionSpec Resource(tok tokens.Type) *pschema.ResourceSpec Type(tok tokens.Type) *pschema.ComplexTypeSpec }
Subset of pschema.PackageSpec required for conversion.
type PropertyNames ¶
type PropertyNames interface { // Translates a Terraform property name for a given type to a Pulumi PropertyKey. // // typeToken identifies the resource, data source, or named object type. PropertyKey(typeToken tokens.Token, property TerraformPropertyName, t tftypes.Type) resource.PropertyKey // Same as PropertyKey but for provider-level configuration properties. ConfigPropertyKey(property TerraformPropertyName, t tftypes.Type) resource.PropertyKey }
type TerraformPropertyName ¶
type TerraformPropertyName = string
An alias to assist marking Terraform-level property names (see for example AttributeTypes in tftypes.Object). Pulumi may rename properties and it is important to keep track of which name is being used during conversion.