Merge pull request #19121 from hashicorp/jbardin/simple-diff

add old values when computing the new InstanceDiff
This commit is contained in:
James Bardin 2018-10-18 20:10:56 -04:00 committed by GitHub
commit 625145563a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -320,6 +320,17 @@ func (r *Resource) simpleDiff(
return instanceDiff, err
}
// Make sure the old value is set in each of the instance diffs.
// This was done by the RequiresNew logic in the full legacy Diff.
for k, attr := range instanceDiff.Attributes {
if attr == nil {
continue
}
if s != nil {
attr.Old = s.Attributes[k]
}
}
if instanceDiff != nil {
if err := t.DiffEncode(instanceDiff); err != nil {
log.Printf("[ERR] Error encoding timeout to instance diff: %s", err)