ignore id when creating diffs

The id field is always computed, and never directly related to a diff.
Since that field is being converted to a regular schema attribute, we
need to handle the behavior in the mocks too.
This commit is contained in:
James Bardin 2018-05-21 19:14:40 -04:00 committed by Martin Atkins
parent 129f5fe74d
commit 7137d85522
1 changed files with 9 additions and 0 deletions

View File

@ -265,6 +265,12 @@ func testDiffFn(
} }
for k, attrDiff := range testFlatAttrDiffs(k, v) { for k, attrDiff := range testFlatAttrDiffs(k, v) {
// we need to ignore 'id' for now, since it's always inferred to be
// computed.
if k == "id" {
continue
}
if k == "require_new" { if k == "require_new" {
attrDiff.RequiresNew = true attrDiff.RequiresNew = true
} }
@ -281,6 +287,9 @@ func testDiffFn(
} }
for _, k := range c.ComputedKeys { for _, k := range c.ComputedKeys {
if k == "id" {
continue
}
diff.Attributes[k] = &ResourceAttrDiff{ diff.Attributes[k] = &ResourceAttrDiff{
Old: "", Old: "",
NewComputed: true, NewComputed: true,