helper/resource: add id to attributes

This commit is contained in:
Mitchell Hashimoto 2014-07-07 15:00:13 -07:00
parent 177f8c094d
commit 21539d08a8
1 changed files with 9 additions and 2 deletions

View File

@ -42,11 +42,18 @@ func (m *Map) Apply(
} }
} }
var result *terraform.ResourceState
var err error
if s.ID == "" { if s.ID == "" {
return r.Create(s, d, meta) result, err = r.Create(s, d, meta)
} else { } else {
return r.Update(s, d, meta) result, err = r.Update(s, d, meta)
} }
if result != nil {
result.Attributes["id"] = s.ID
}
return result, err
} }
// Diff peforms a diff on the proper resource type. // Diff peforms a diff on the proper resource type.