Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Elem() in the shim #644

Merged
merged 1 commit into from Nov 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/tfshim/shim.go
Expand Up @@ -75,7 +75,20 @@ type Schema interface {
Computed() bool
ForceNew() bool
StateFunc() SchemaStateFunc

// s.Elem() may return a nil, a Schema value, or a Resource value.
//
// If s represents an element or block of a compound type such TypeList, TypeSet or TypeMap, s.Elem() returns a
// Schema value representing its element type. That is, if s ~ List[String] then s.Elem() ~ String.
//
// If s.Elem() returns a Resource, s represens a configuration block, and s.Elem() Resource only implements the
// Schema field, denoting the schema of the block.
//
// The design of Elem() follows Terraform Plugin SDK directly.
//
// See also: https://github.com/hashicorp/terraform-plugin-sdk/blob/main/helper/schema/schema.go#L231
Elem() interface{}

MaxItems() int
MinItems() int
ConflictsWith() []string
Expand Down