6 "github.com/hashicorp/go-getter"
8 "github.com/hashicorp/terraform/registry/regsrc"
11 var localSourcePrefixes = []string{
18 func isLocalSourceAddr(addr string) bool {
19 for _, prefix := range localSourcePrefixes {
20 if strings.HasPrefix(addr, prefix) {
27 func isRegistrySourceAddr(addr string) bool {
28 _, err := regsrc.ParseModuleSource(addr)
32 // splitAddrSubdir splits the given address (which is assumed to be a
33 // registry address or go-getter-style address) into a package portion
34 // and a sub-directory portion.
36 // The package portion defines what should be downloaded and then the
37 // sub-directory portion, if present, specifies a sub-directory within
38 // the downloaded object (an archive, VCS repository, etc) that contains
39 // the module's configuration files.
41 // The subDir portion will be returned as empty if no subdir separator
42 // ("//") is present in the address.
43 func splitAddrSubdir(addr string) (packageAddr, subDir string) {
44 return getter.SourceDirSubdir(addr)