Documentation ¶
Index ¶
- func Join(opts JoinOptions, path *tftypes.AttributePath, x, y *tftypes.Value) (*tftypes.Value, error)
- func ProposedNew(ctx context.Context, schema Schema, priorState, config tftypes.Value) (tftypes.Value, error)
- type Attr
- type AttrLike
- type Block
- type BlockLike
- type BlockNestingMode
- type DataSources
- type Diff
- type Eq
- type JoinOptions
- type LookupResult
- type NestingMode
- type Resources
- type Schema
- type TypeName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Join ¶
func Join(opts JoinOptions, path *tftypes.AttributePath, x, y *tftypes.Value) (*tftypes.Value, error)
Joins two values. The missing combinator from tftypes, which provides Diff and Walk but no ability to join.
func ProposedNew ¶
func ProposedNew(ctx context.Context, schema Schema, priorState, config tftypes.Value) (tftypes.Value, error)
Computes the ProposedNewState from priorState and config.
Likely the canonical implementaiton is ProposedNew objchange.go:
https://github.com/hashicorp/terraform/blob/v1.3.6/internal/plans/objchange/objchange.go#L27-#L27
Terraform core does this as a utility to providers to make their code easier; therefore the bridge has to do it also, as it imitates Terraform core.
Quote from TF docs serves as a spec:
The ProposedNewState merges any non-null values in the configuration with any computed attributes in PriorState as a utility to help providers avoid needing to implement such merging functionality themselves. The state is represented as a tftypes.Object, with each attribute and nested block getting its own key and value. The ProposedNewState will be null when planning a delete operation.
When Pulumi programs retract attributes, config (checkedInputs) will have no entry for these, while priorState might have an entry. ProposedNewState must have a Null entry in this case for Diff to work properly and recognize an attribute deletion.
Types ¶
type Attr ¶
type Attr interface { AttrLike IsNested() bool Nested() map[string]Attr NestingMode() NestingMode HasNestedObject() bool }
Attr type works around not being able to link to fwschema.Attribute from "github.com/hashicorp/terraform-plugin-framework/internal/fwschema"
Most methods from fwschema.Attribute have simple signatures and are copied into attrLike interface. Casting to attrLike exposes these methods.
GetAttributes method is special since it returns a NestedAttributes interface that is also internal and cannot be linked to. Instead, NestedAttriutes information is recorded in a dedicated new field.
func FromAttrLike ¶
func FromDataSourceAttribute ¶
func FromProviderAttribute ¶
func FromResourceAttribute ¶
type Block ¶
type Block interface { BlockLike NestedAttrs() map[string]Attr NestedBlocks() map[string]Block GetMaxItems() int64 GetMinItems() int64 HasNestedObject() bool }
Block type works around not being able to link to fwschema.Block from "github.com/hashicorp/terraform-plugin-framework/internal/fwschema".
func FromBlockLike ¶
func FromDataSourceBlock ¶
func FromProviderBlock ¶
func FromResourceBlock ¶
type BlockNestingMode ¶
type BlockNestingMode uint8
const ( BlockNestingModeUnknown BlockNestingMode = 0 BlockNestingModeList BlockNestingMode = 1 BlockNestingModeSet BlockNestingMode = 2 BlockNestingModeSingle BlockNestingMode = 3 )
type DataSources ¶
type DataSources interface { All() []TypeName Has(TypeName) bool Schema(TypeName) Schema Diagnostics(TypeName) diag.Diagnostics AllDiagnostics() diag.Diagnostics DataSource(TypeName) datasource.DataSource }
Represents all provider's datasources pre-indexed by TypeName.
func GatherDatasources ¶
type Eq ¶
var DefaultEq Eq = defaultEq(0)
Default equality for tftype.Value.
func NonComputedEq ¶
Considers two tftype.Value values equal if all their non-computed attributes are equal.
type JoinOptions ¶
type JoinOptions struct { // Reconciles two values that are not both present or else present but not Equal. At least one of the values is // immediate. Immediate values are nulls, unknowns, and scalar values (not List, Set, Map, Object). Reconcile func(Diff) (*tftypes.Value, error) // Optional. Allows overriding how set elements are compared for equality. SetElementEqual Eq }
Configures how to join two values.
type LookupResult ¶
func LookupTerraformPath ¶
func LookupTerraformPath(schema Schema, path *tftypes.AttributePath) (LookupResult, error)
type NestingMode ¶
type NestingMode uint8
const ( NestingModeUnknown NestingMode = 0 NestingModeSingle NestingMode = 1 NestingModeList NestingMode = 2 NestingModeSet NestingMode = 3 NestingModeMap NestingMode = 4 )
type Resources ¶
type Resources interface { All() []TypeName Has(TypeName) bool Schema(TypeName) Schema Diagnostics(TypeName) diag.Diagnostics AllDiagnostics() diag.Diagnostics Resource(TypeName) resource.Resource }
Represents all provider's resources pre-indexed by TypeName.
type Schema ¶
type Schema interface { tftypes.AttributePathStepper Type() attr.Type Attrs() map[string]Attr Blocks() map[string]Block DeprecationMessage() string AttributeAtPath(context.Context, path.Path) (Attr, diag.Diagnostics) }
Attr type works around not being able to link to fwschema.Schema from "github.com/hashicorp/terraform-plugin-framework/internal/fwschema"