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.
This commit is contained in:
Martin Atkins 2018-05-02 20:14:18 -07:00
parent a28c93c3ce
commit ca67899827
1 changed files with 1 additions and 1 deletions

View File

@ -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 {