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.
This commit is contained in:
Martin Atkins 2018-05-01 11:53:07 -07:00
parent 226d66bac8
commit fa2a76fa23
2 changed files with 6 additions and 4 deletions

View File

@ -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.

View File

@ -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