Skip to content

Commit

Permalink
helper/schema: TypeMap computed should mark diff as cmputed
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Dec 9, 2014
1 parent c43eb6f commit b73078c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions helper/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
23 changes: 23 additions & 0 deletions helper/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit b73078c

Please sign in to comment.