Documentation ¶
Index ¶
- Constants
- func ToTerraformAttribute[A any](a Attribute, types *AttributeTypes[A]) (*A, error)
- func ToTerraformBlock[B, A any](b Block, toListBlock ToListBlock[B, A], toSetBlock ToSetBlock[B, A], ...) (*B, error)
- type Attribute
- type AttributeTypes
- type Block
- type Schema
- type ToListBlock
- type ToSetBlock
- type Type
Constants ¶
const ( NestingModeList = "list" NestingModeSet = "set" )
Variables ¶
This section is empty.
Functions ¶
func ToTerraformAttribute ¶ added in v0.1.3
func ToTerraformAttribute[A any](a Attribute, types *AttributeTypes[A]) (*A, error)
ToTerraformAttribute converts our representation of an Attribute into a Terraform SDK attribute so it can be passed back to Terraform Core in a resource or data source schema.
func ToTerraformBlock ¶ added in v0.1.3
func ToTerraformBlock[B, A any](b Block, toListBlock ToListBlock[B, A], toSetBlock ToSetBlock[B, A], attributeTypes *AttributeTypes[A]) (*B, error)
ToTerraformBlock converts our representation of a Block into a Terraform SDK block so it can be passed back to Terraform Core in a resource or data source schema.
Types ¶
type Attribute ¶
type Attribute struct { Description string `json:"-"` // Dynamic resources don't need descriptions so hide them from the exposed JSON schema. MarkdownDescription string `json:"-"` // Dynamic resources don't need descriptions so hide them from the exposed JSON schema. Type Type `json:"type"` Optional bool `json:"optional"` Required bool `json:"required"` Computed bool `json:"computed"` Value *data.Value `json:"value,omitempty"` List *Attribute `json:"list,omitempty"` Map *Attribute `json:"map,omitempty"` Object map[string]Attribute `json:"object,omitempty"` Set *Attribute `json:"set,omitempty"` Sensitive bool `json:"sensitive"` // True if values for this attribute should be hidden in the plan. Replace bool `json:"replace"` // True if the resource should be replaced when this attribute changes. // SkipNestedMetadata instructs the dynamic resource to not use the nested // attribute field when building element and attribute types of complex // attributes (list, map, object, and set). SkipNestedMetadata bool `json:"skip_nested_metadata"` }
Attribute defines an internal representation of a Terraform attribute in a schema.
It is designed to be read dynamically from a JSON object, allowing schemas, blocks and attributes to be defined dynamically by the user of the provider.
For data sources, the values provided in the optional, required and computed field are ignored. All data source attributes are computed, with optional and required being set to false regardless of the actual values for those fields. The generated ID attribute is unique and marked as required and not computed as it is used to identify the data source and retrieve it during the Terraform operations.
type AttributeTypes ¶ added in v0.1.3
type AttributeTypes[A any] struct { // contains filtered or unexported fields }
AttributeTypes contains functions that map provider attributes into Terraform resource or datasource attributes.
type Block ¶
type Block struct { Description string `json:"-"` // Dynamic resources don't need descriptions so hide them from the exposed JSON schema. MarkdownDescription string `json:"-"` // Dynamic resources don't need descriptions so hide them from the exposed JSON schema. Attributes map[string]Attribute `json:"attributes"` Blocks map[string]Block `json:"blocks"` Mode string `json:"mode"` }
Block defines an internal representation of a Terraform block in a schema.
It is designed to be read dynamically from a JSON object, allowing schemas, blocks and attributes to be defined dynamically by the user of the provider.
type Schema ¶
type Schema struct { Description string `json:"-"` // Dynamic resources don't need descriptions so hide them from the exposed JSON schema. MarkdownDescription string `json:"-"` // Dynamic resources don't need descriptions so hide them from the exposed JSON schema. Attributes map[string]Attribute `json:"attributes"` Blocks map[string]Block `json:"blocks"` }
Schema defines an internal representation of a Terraform schema.
It is designed to be read dynamically from a JSON object, allowing schemas, blocks and attributes to be defined dynamically by the user of the provider.
func (Schema) AllAttributes ¶
AllAttributes returns the attributes for the dynamic schema, plus the required ID attribute that is attached to tfsdk.Schema objects automatically.
func (Schema) ToTerraformDataSourceSchema ¶
func (schema Schema) ToTerraformDataSourceSchema() (datasource_schema.Schema, error)
ToTerraformDataSourceSchema converts our representation of a Schema into a Terraform SDK tfsdk.Schema. It automatically creates and attaches a required attribute called `id` that is required by every resource and data source in this provider.
func (Schema) ToTerraformResourceSchema ¶
func (schema Schema) ToTerraformResourceSchema() (resource_schema.Schema, error)
ToTerraformResourceSchema converts out representation of a Schema into a Terraform SDK tfsdk.Schema. It automatically creates and attaches a computed type called `id` that is required by every resource and data source in this provider.