tfsdk

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MPL-2.0 Imports: 9 Imported by: 227

Documentation

Overview

Package tfsdk contains core framework functionality for schema data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertValue added in v0.4.0

func ConvertValue(ctx context.Context, val attr.Value, typ attr.Type) (attr.Value, diag.Diagnostics)

ConvertValue creates a new attr.Value of the attr.Type `typ`, using the data in `val`, which can be of any attr.Type so long as its TerraformType method returns a tftypes.Type that `typ`'s ValueFromTerraform method can accept.

func ValueAs added in v0.3.0

func ValueAs(ctx context.Context, val attr.Value, target interface{}) diag.Diagnostics

ValueAs takes the attr.Value `val` and populates the Go value `target` with its content.

This is achieved using reflection rules provided by the internal/reflect package.

func ValueFrom added in v0.9.0

func ValueFrom(ctx context.Context, val interface{}, targetType attr.Type, target interface{}) diag.Diagnostics

ValueFrom takes the Go value `val` and populates `target` with an attr.Value, based on the type definition provided in `targetType`.

This is achieved using reflection rules provided by the internal/reflect package.

Types

type Config

type Config struct {
	Raw    tftypes.Value
	Schema fwschema.Schema
}

Config represents a Terraform config.

func (Config) Get

func (c Config) Get(ctx context.Context, target interface{})