func fromProviderSchemaBlock()

in azurerm/schema/core_schema.go [100:129]


func fromProviderSchemaBlock(ps *schema.Schema) *SchemaBlockType {
	ret := &SchemaBlockType{
		Required: ps.Required,
		Optional: ps.Optional,
		Computed: ps.Computed,

		ConflictsWith: ps.ConflictsWith,
		ExactlyOneOf:  ps.ExactlyOneOf,
		AtLeastOneOf:  ps.AtLeastOneOf,
		RequiredWith:  ps.RequiredWith,
	}

	if nested := fromProviderResource(ps.Elem.(*schema.Resource)); nested != nil {
		ret.Block = nested
	}

	switch ps.Type {
	case schema.TypeList:
		ret.NestingMode = NestingList
	case schema.TypeSet:
		ret.NestingMode = NestingSet
	case schema.TypeMap:
		ret.NestingMode = NestingMap
	default:
		// Should never happen for a valid schema
		panic(fmt.Errorf("invalid s.Type %s for s.Elem being resource", ps.Type))
	}

	return ret
}