Skip to content

Consider Adding tfprotov5/tfprotov6 Schema* Methods for tftypes.Type Conversion #157

@bflad

Description

@bflad

terraform-plugin-go version

v0.7.1

Use cases

Downstream implementations, whether SDKs or providers, may need to retrieve the tftypes.Type equivalent of tfprotov5/tfprotov6 schema types such as:

  • Schema
  • SchemaAttribute
  • SchemaBlock
  • SchemaNestedBlock
  • SchemaObject

For example, this is necessary for calling (DynamicValue).Unmarshal(), which is necessary for data handling of ApplyResourceChange and other RPCs.

Attempted solutions

Manually (re-)implementing this logic downstream.

Proposal

Implement methods such as the following:

// package tfprotov5
func (s *Schema) Type() tftypes.Type { /* ... */ }
func (s *SchemaAttribute) Type() tftypes.Type { /* ... */ }
func (s *SchemaBlock) Type() tftypes.Type { /* ... */ }
func (s *SchemaNestedBlock) Type() tftypes.Type { /* ... */ }

// package tfprotov6
func (s *Schema) Type() tftypes.Type { /* ... */ }
func (s *SchemaAttribute) Type() tftypes.Type { /* ... */ }
func (s *SchemaBlock) Type() tftypes.Type { /* ... */ }
func (s *SchemaNestedBlock) Type() tftypes.Type { /* ... */ }
func (s *SchemaObject) Type() tftypes.Type { /* ... */ }

With associated unit testing.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions