From eb54715902874d5c690d9adb39a7a755c4757062 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Tue, 22 May 2018 18:04:06 -0700 Subject: [PATCH] core: fix string rendering of modules in diffs This was assuming our old practice of a slice starting with the string "root". We'll normalize here and then stringify the result to ensure that we get a string consistent with what's used elsewhere. This is primarily aimed at fixing some of the context plan tests. --- terraform/diff.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/diff.go b/terraform/diff.go index 2b409aa5b..8805b0be8 100644 --- a/terraform/diff.go +++ b/terraform/diff.go @@ -185,7 +185,8 @@ func (d *Diff) String() string { keys := make([]string, 0, len(d.Modules)) lookup := make(map[string]*ModuleDiff) for _, m := range d.Modules { - key := fmt.Sprintf("module.%s", strings.Join(m.Path[1:], ".")) + addr := normalizeModulePath(m.Path) + key := addr.String() keys = append(keys, key) lookup[key] = m }