@ -95,34 +95,6 @@ type Schema struct {
// behavior, and SchemaConfigModeBlock is not permitted.
ConfigMode SchemaConfigMode
// SkipCoreTypeCheck, if set, will advertise this attribute to Terraform Core
// has being dynamically-typed rather than deriving a type from the schema.
// This has the effect of making Terraform Core skip all type-checking of
// the value, and thus leaves all type checking up to a combination of this
// SDK and the provider's own code.
//
// This flag does nothing for Terraform versions prior to v0.12, because
// in prior versions there was no Core-side typecheck anyway.
//
// The most practical effect of this flag is to allow object-typed schemas
// (specified with Elem: schema.Resource) to pass through Terraform Core
// even without all of the object type attributes specified, which may be
// useful when using ConfigMode: SchemaConfigModeAttr to achieve
// nested-block-like behaviors while using attribute syntax.
//
// However, by doing so we require type information to be sent and stored
// per-object rather than just once statically in the schema, and so this
// will change the wire serialization of a resource type in state. Changing
// the value of SkipCoreTypeCheck will therefore require a state migration
// if there has previously been any release of the provider compatible with
// Terraform v0.12.
//
// SkipCoreTypeCheck can only be set when ConfigMode is SchemaConfigModeAttr,
// because nested blocks cannot be decoded by Terraform Core without at
// least shallow information about the next level of nested attributes and
// blocks.
SkipCoreTypeCheck bool
// If one of these is set, then this item can come from the configuration.
// Both cannot be set. If Optional is set, the value is optional. If
// Required is set, the value is required.
@ -735,8 +707,6 @@ func (m schemaMap) internalValidate(topSchemaMap schemaMap, attrsOnly bool) erro
computedOnly := v . Computed && ! v . Optional
isBlock := false
switch v . ConfigMode {
case SchemaConfigModeBlock :
if _ , ok := v . Elem . ( * Resource ) ; ! ok {
@ -748,7 +718,6 @@ func (m schemaMap) internalValidate(topSchemaMap schemaMap, attrsOnly bool) erro
if computedOnly {
return fmt . Errorf ( "%s: ConfigMode of block cannot be used for computed schema" , k )
}
isBlock = true
case SchemaConfigModeAttr :
// anything goes
case SchemaConfigModeAuto :
@ -756,7 +725,6 @@ func (m schemaMap) internalValidate(topSchemaMap schemaMap, attrsOnly bool) erro
// and that's impossible inside an attribute, we require it to be
// explicitly overridden as mode "Attr" for clarity.
if _ , ok := v . Elem . ( * Resource ) ; ok {
isBlock = true
if attrsOnly {
return fmt . Errorf ( "%s: in *schema.Resource with ConfigMode of attribute, so must also have ConfigMode of attribute" , k )
}
@ -765,10 +733,6 @@ func (m schemaMap) internalValidate(topSchemaMap schemaMap, attrsOnly bool) erro
return fmt . Errorf ( "%s: invalid ConfigMode value" , k )
}
if isBlock && v . SkipCoreTypeCheck {
return fmt . Errorf ( "%s: SkipCoreTypeCheck must be false unless ConfigMode is attribute" , k )
}
if v . Computed && v . Default != nil {
return fmt . Errorf ( "%s: Default must be nil if computed" , k )
}