From fa2a76fa239dcd7ebbffecb79ce0ed96bced201b Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Tue, 1 May 2018 11:53:07 -0700 Subject: [PATCH] configs: use addrs.Module for module path, rather than []string addrs.Module is itself internally just []string, but this better communicates our intent here and makes this integrate better with other code which is using this type for this purposes. --- configs/config_build.go | 3 ++- configs/configload/module_manifest.go | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/configs/config_build.go b/configs/config_build.go index 8f7fa6b16d..948b2c8ffd 100644 --- a/configs/config_build.go +++ b/configs/config_build.go @@ -5,6 +5,7 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform/addrs" ) // BuildConfig constructs a Config from a root module by loading all of its @@ -123,7 +124,7 @@ type ModuleRequest struct { // this module. This can be used, for example, to form a lookup key for // each distinct module call in a configuration, allowing for multiple // calls with the same name at different points in the tree. - Path []string + Path addrs.Module // SourceAddr is the source address string provided by the user in // configuration. diff --git a/configs/configload/module_manifest.go b/configs/configload/module_manifest.go index 777f3a282f..0a2348be82 100644 --- a/configs/configload/module_manifest.go +++ b/configs/configload/module_manifest.go @@ -5,9 +5,10 @@ import ( "fmt" "os" "path/filepath" - "strings" version "github.com/hashicorp/go-version" + + "github.com/hashicorp/terraform/addrs" ) // moduleRecord represents some metadata about an installed module, as part @@ -43,8 +44,8 @@ type moduleRecord struct { // it to reflect any changes to the installed modules. type moduleManifest map[string]moduleRecord -func manifestKey(path []string) string { - return strings.Join(path, ".") +func manifestKey(path addrs.Module) string { + return path.String() } // manifestSnapshotFile is an internal struct used only to assist in our JSON