add failing test case

This case should be expected to fail with the current diff algorithm,
but the existing behavior was widely relied upon so we need to roll this
back until there is a representable nil value.
This commit is contained in:
James Bardin 2017-12-19 15:07:37 -05:00
parent 80e3511c9d
commit 7a8a443994
1 changed files with 30 additions and 0 deletions

View File

@ -3110,6 +3110,36 @@ func TestSchemaMap_Diff(t *testing.T) {
Err: true,
},
// A lot of resources currently depended on using the empty string as a
// nil/unset value.
{
Name: "optional, computed, empty string",
Schema: map[string]*Schema{
"attr": &Schema{
Type: TypeString,
Optional: true,
Computed: true,
},
},
State: &terraform.InstanceState{
Attributes: map[string]string{
"attr": "bar",
},
},
// this does necessarily depend on an interpolated value, but this
// is often how it comes about in a configuration, otherwise the
// value would be unset.
Config: map[string]interface{}{
"attr": "${var.foo}",
},
ConfigVariables: map[string]ast.Variable{
"var.foo": interfaceToVariableSwallowError(""),
},
},
}
for i, tc := range cases {