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:
parent
a28c93c3ce
commit
ca67899827
|
@ -362,7 +362,7 @@ func NewLegacyResourceInstanceAddress(addr addrs.AbsResourceInstance) *ResourceA
|
||||||
ret.Path = path
|
ret.Path = path
|
||||||
|
|
||||||
if addr.Resource.Key == addrs.NoKey {
|
if addr.Resource.Key == addrs.NoKey {
|
||||||
ret.Index = 0
|
ret.Index = -1
|
||||||
} else if ik, ok := addr.Resource.Key.(addrs.IntKey); ok {
|
} else if ik, ok := addr.Resource.Key.(addrs.IntKey); ok {
|
||||||
ret.Index = int(ik)
|
ret.Index = int(ik)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue