Merge pull request #676 from svanharmelen/f-fix-expand-bug

core: fix expand bug
This commit is contained in:
Sander van Harmelen 2014-12-16 11:04:25 +01:00
commit 40ca4c1c81
1 changed files with 15 additions and 13 deletions

View File

@ -1816,21 +1816,23 @@ func (n *GraphNodeResource) expand(g *depgraph.Graph, count int, diff *ModuleDif
delete(keys, name)
}
if state == nil {
if count == 1 {
// If the count is one, check the state for ".0"
// appended, which might exist if we go from
// count > 1 to count == 1.
k := r.Id() + ".0"
if state == nil {
state = n.State.Resources[k]
}
delete(keys, k)
} else if i == 0 {
// If count is greater than one, check for state
// with just the ID, which might exist if we go
// from count == 1 to count > 1
if state == nil {
state = n.State.Resources[r.Id()]
delete(keys, r.Id())
}
delete(keys, r.Id())
}
}