core: NewLegacyResourceInstanceAddress correct handling of addrs.NoKey

Previously we were setting zero here, but the correct way to represent
"no index" in a *ResourceAddress is to set the index to -1.
f-hcl2-planstate
Martin Atkins 8 years ago
parent f9a9989a59
commit db319ae35e

@ -362,7 +362,7 @@ func NewLegacyResourceInstanceAddress(addr addrs.AbsResourceInstance) *ResourceA
ret.Path = path
if addr.Resource.Key == addrs.NoKey {
ret.Index = 0
ret.Index = -1
} else if ik, ok := addr.Resource.Key.(addrs.IntKey); ok {
ret.Index = int(ik)
} else {

Loading…
Cancel
Save