helper/schema: don't say that a set is computed if it exists

This commit is contained in:
Mitchell Hashimoto 2014-10-10 15:46:24 -07:00
parent 36f225dea0
commit e5d64318bf
2 changed files with 27 additions and 0 deletions

View File

@ -304,6 +304,7 @@ func (d *ResourceData) getSet(
return d.getList(k, parts, schema, source)
}
result.Exists = raw.Exists
return result
}

View File

@ -641,6 +641,32 @@ func TestSchemaMap_Diff(t *testing.T) {
Err: false,
},
{
Schema: map[string]*Schema{
"ports": &Schema{
Type: TypeSet,
Computed: true,
Required: true,
Elem: &Schema{Type: TypeInt},
Set: func(a interface{}) int {
return a.(int)
},
},
},
State: &terraform.InstanceState{
Attributes: map[string]string{
"ports.#": "0",
},
},
Config: nil,
Diff: nil,
Err: false,
},
{
Schema: map[string]*Schema{
"ports": &Schema{