From d0693d0db5729e141b893554531413df270e85c0 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 23 May 2018 22:21:10 -0400 Subject: [PATCH] fix InstanceInfo.HumanId The module no longer has a "root" component, and use the normalizeModulePath function for consistency --- terraform/resource.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/terraform/resource.go b/terraform/resource.go index a5def42150..f93a89b4c0 100644 --- a/terraform/resource.go +++ b/terraform/resource.go @@ -145,18 +145,11 @@ func NewInstanceInfo(addr addrs.AbsResource) *InstanceInfo { // HumanId is a unique Id that is human-friendly and useful for UI elements. func (i *InstanceInfo) HumanId() string { - if i == nil { - return "" - } - - if len(i.ModulePath) <= 1 { + p := normalizeModulePath(i.ModulePath) + if p.IsRoot() { return i.Id } - - return fmt.Sprintf( - "module.%s.%s", - strings.Join(i.ModulePath[1:], "."), - i.Id) + return fmt.Sprintf("%s.%s", p.String(), i.Id) } // ResourceAddress returns the address of the resource that the receiver is describing.