helper/schema: TypeMap computed should mark diff as cmputed

This commit is contained in:
Mitchell Hashimoto 2014-12-09 00:39:02 -08:00
parent c43eb6f883
commit b73078c670
2 changed files with 30 additions and 0 deletions

View File

@ -584,6 +584,13 @@ func (m schemaMap) diffMap(
// If the new map is nil and we're computed, then ignore it.
if n == nil && schema.Computed {
// If we don't have an old value, this whole map is computed
if o == nil {
diff.Attributes[k] = &terraform.ResourceAttrDiff{
NewComputed: true,
}
}
return nil
}

View File

@ -1292,6 +1292,29 @@ func TestSchemaMap_Diff(t *testing.T) {
Err: false,
},
{
Schema: map[string]*Schema{
"vars": &Schema{
Type: TypeMap,
Computed: true,
},
},
State: nil,
Config: nil,
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"vars": &terraform.ResourceAttrDiff{
NewComputed: true,
},
},
},
Err: false,
},
{
Schema: map[string]*Schema{
"config_vars": &Schema{