helper/schema: Schema.Elem documentation for TypeMap

Updated it to state that Elem is valid for TypeMaps too, and that TypeSets can use a Resource as an Elem.
This commit is contained in:
Dana Hoffman 2017-10-26 10:29:47 -07:00 committed by Martin Atkins
parent a49834a223
commit a7e308fc2c
1 changed files with 9 additions and 6 deletions

View File

@ -116,12 +116,16 @@ type Schema struct {
ForceNew bool ForceNew bool
StateFunc SchemaStateFunc StateFunc SchemaStateFunc
// The following fields are only set for a TypeList or TypeSet Type. // The following fields are only set for a TypeList, TypeSet, or TypeMap.
// //
// Elem must be either a *Schema or a *Resource only if the Type is // Elem represents the element type. For a TypeMap, it must be a *Schema
// TypeList, and represents what the element type is. If it is *Schema, // with a Type of TypeString, otherwise it may be either a *Schema or a
// the element type is just a simple value. If it is *Resource, the // *Resource. If it is *Schema, the element type is just a simple value.
// element type is a complex structure, potentially with its own lifecycle. // If it is *Resource, the element type is a complex structure,
// potentially with its own lifecycle.
Elem interface{}
// The following fields are only set for a TypeList or TypeSet.
// //
// MaxItems defines a maximum amount of items that can exist within a // MaxItems defines a maximum amount of items that can exist within a
// TypeSet or TypeList. Specific use cases would be if a TypeSet is being // TypeSet or TypeList. Specific use cases would be if a TypeSet is being
@ -138,7 +142,6 @@ type Schema struct {
// ["foo"] automatically. This is primarily for legacy reasons and the // ["foo"] automatically. This is primarily for legacy reasons and the
// ambiguity is not recommended for new usage. Promotion is only allowed // ambiguity is not recommended for new usage. Promotion is only allowed
// for primitive element types. // for primitive element types.
Elem interface{}
MaxItems int MaxItems int
MinItems int MinItems int
PromoteSingle bool PromoteSingle bool