diff --git a/helper/schema/resource_data.go b/helper/schema/resource_data.go index 0b75f16dc..d2f662884 100644 --- a/helper/schema/resource_data.go +++ b/helper/schema/resource_data.go @@ -273,7 +273,7 @@ func (d *ResourceData) getPrimitive( if d.diff != nil && source >= getSourceDiff { attrD, ok := d.diff.Attributes[k] - if ok { + if ok && !attrD.NewComputed { result = attrD.New resultSet = true } diff --git a/helper/schema/resource_data_test.go b/helper/schema/resource_data_test.go index 0ec7832cb..a0698dd07 100644 --- a/helper/schema/resource_data_test.go +++ b/helper/schema/resource_data_test.go @@ -15,6 +15,33 @@ func TestResourceDataGet(t *testing.T) { Key string Value interface{} }{ + { + Schema: map[string]*Schema{ + "availability_zone": &Schema{ + Type: TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + + State: nil, + + Diff: &terraform.ResourceDiff{ + Attributes: map[string]*terraform.ResourceAttrDiff{ + "availability_zone": &terraform.ResourceAttrDiff{ + Old: "", + New: "", + NewComputed: true, + }, + }, + }, + + Key: "availability_zone", + + Value: nil, + }, + { Schema: map[string]*Schema{ "availability_zone": &Schema{