diff --git a/helper/schema/schema.go b/helper/schema/schema.go index 515b080d2..3e2d6f429 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -401,9 +401,14 @@ func (m schemaMap) diffString( } if os == ns { - // They're the same value, return no diff as long as we're not - // computing a new value. - if os != "" || !schema.Computed { + // They're the same value. If there old value is not blank or we + // have an ID, then return right away since we're already setup. + if os != "" || d.Id() != "" { + return nil + } + + // Otherwise, only continue if we're computed + if !schema.Computed { return nil } } diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index ac1f827e5..0b6b9ef0d 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -76,6 +76,27 @@ func TestSchemaMap_Diff(t *testing.T) { Err: false, }, + { + Schema: map[string]*Schema{ + "availability_zone": &Schema{ + Type: TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + + State: &terraform.ResourceState{ + ID: "foo", + }, + + Config: map[string]interface{}{}, + + Diff: nil, + + Err: false, + }, + // String with StateFunc { Schema: map[string]*Schema{