diff --git a/helper/schema/resource_data.go b/helper/schema/resource_data.go index ac86b6599..650cf2b60 100644 --- a/helper/schema/resource_data.go +++ b/helper/schema/resource_data.go @@ -91,7 +91,7 @@ func (d *ResourceData) GetChange(key string) (interface{}, interface{}) { // The second result should be checked to determine this information. func (d *ResourceData) GetOk(key string) (interface{}, bool) { r := d.getRaw(key, getSourceSet) - return r.Value, r.Exists + return r.Value, r.Exists && !r.Computed } func (d *ResourceData) getRaw(key string, level getSource) getResult { diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 2f8d64ec5..8129d5184 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -868,7 +868,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ "ports.#": &terraform.ResourceAttrDiff{ - Old: "0", + Old: "", New: "", NewComputed: true, }, @@ -1560,7 +1560,6 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ "instances.#": &terraform.ResourceAttrDiff{ - Old: "0", NewComputed: true, }, }, @@ -1688,7 +1687,6 @@ func TestSchemaMap_Diff(t *testing.T) { New: "1", }, "route.~1.gateway.#": &terraform.ResourceAttrDiff{ - Old: "0", NewComputed: true, }, },