From db319ae35e287cabeb1112bb392f1c4513f89ef6 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Wed, 2 May 2018 20:14:18 -0700 Subject: [PATCH] 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. --- terraform/resource_address.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/resource_address.go b/terraform/resource_address.go index f7b3519789..156ecf5c0e 100644 --- a/terraform/resource_address.go +++ b/terraform/resource_address.go @@ -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 {