helper/schema: test pass from SvH
This commit is contained in:
parent
913f9a923e
commit
df05483cf6
|
@ -583,6 +583,10 @@ func (m schemaMap) diffMap(
|
||||||
return fmt.Errorf("%s: %s", k, err)
|
return fmt.Errorf("%s: %s", k, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete any count values, since we don't use those
|
||||||
|
delete(configMap, "#")
|
||||||
|
delete(stateMap, "#")
|
||||||
|
|
||||||
// Check if the number of elements has changed. If we're computing
|
// Check if the number of elements has changed. If we're computing
|
||||||
// a list and there isn't a config, then it hasn't changed.
|
// a list and there isn't a config, then it hasn't changed.
|
||||||
oldLen, newLen := len(stateMap), len(configMap)
|
oldLen, newLen := len(stateMap), len(configMap)
|
||||||
|
|
|
@ -1697,6 +1697,43 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
|
|
||||||
Err: false,
|
Err: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// #44 - Computed maps
|
||||||
|
{
|
||||||
|
Schema: map[string]*Schema{
|
||||||
|
"vars": &Schema{
|
||||||
|
Type: TypeMap,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
State: &terraform.InstanceState{
|
||||||
|
Attributes: map[string]string{
|
||||||
|
"vars.#": "0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
Config: map[string]interface{}{
|
||||||
|
"vars": map[string]interface{}{
|
||||||
|
"bar": "${var.foo}",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
ConfigVariables: map[string]string{
|
||||||
|
"var.foo": config.UnknownVariableValue,
|
||||||
|
},
|
||||||
|
|
||||||
|
Diff: &terraform.InstanceDiff{
|
||||||
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
|
"vars.#": &terraform.ResourceAttrDiff{
|
||||||
|
Old: "",
|
||||||
|
NewComputed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
Err: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, tc := range cases {
|
for i, tc := range cases {
|
||||||
|
|
Loading…
Reference in New Issue