mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-26 16:36:26 -06:00
helper/schema: validate Set is a set type [GH-413]
This commit is contained in:
parent
1912e9655d
commit
2b50d44aa4
@ -9,6 +9,7 @@ BUG FIXES:
|
||||
computed so the value is still unknown.
|
||||
* core: If a resource fails to create and has provisioners, it is
|
||||
marked as tainted. [GH-434]
|
||||
* core: Set types are validated to be sets. [GH-413]
|
||||
* providers/aws: Refresh of launch configs and autoscale groups load
|
||||
the correct data and don't incorrectly recreate themselves. [GH-425]
|
||||
* providers/aws: Fix case where ELB would incorrectly plan to modify
|
||||
|
@ -819,6 +819,8 @@ func (m schemaMap) validatePrimitive(
|
||||
}
|
||||
|
||||
switch schema.Type {
|
||||
case TypeSet:
|
||||
fallthrough
|
||||
case TypeList:
|
||||
return m.validateList(k, raw, schema, c)
|
||||
case TypeInt:
|
||||
|
@ -1970,6 +1970,26 @@ func TestSchemaMap_Validate(t *testing.T) {
|
||||
|
||||
Err: true,
|
||||
},
|
||||
|
||||
// Not a set
|
||||
{
|
||||
Schema: map[string]*Schema{
|
||||
"ports": &Schema{
|
||||
Type: TypeSet,
|
||||
Required: true,
|
||||
Elem: &Schema{Type: TypeInt},
|
||||
Set: func(a interface{}) int {
|
||||
return a.(int)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Config: map[string]interface{}{
|
||||
"ports": "foo",
|
||||
},
|
||||
|
||||
Err: true,
|
||||
},
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
|
Loading…
Reference in New Issue
Block a user