func NewModule(host, namespace, name, provider, submodule string) (*Module, error) {
	m := &Module{
		RawNamespace: namespace,
		RawName:      name,
		RawProvider:  provider,
		RawSubmodule: submodule,
	}
	if host != "" {
		h := NewFriendlyHost(host)
		if h != nil {
			fmt.Println("HOST:", h)
			if !h.Valid() || disallowed[h.Display()] {
				return nil, ErrInvalidModuleSource
			}
		}
		m.RawHost = h
	}
	return m, nil
}
NewModule construct a new module source from separate parts. Pass empty
string if host or submodule are not needed.
package regsrc
import (
	"errors"
	"fmt"
	"regexp"
	"strings"
	"github.com/hashicorp/terraform-svchost"
)
var (
	ErrInvalidModuleSource = errors.New("not a valid registry module source")
	nameSubRe = "[0-9A-Za-z](?:[0-9A-Za-z-_]{0,62}[0-9A-Za-z])?"
	providerSubRe = "[0-9a-z]{1,64}"
	moduleSourceRe = regexp.MustCompile(
		fmt.Sprintf("^(%s)\\/(%s)\\/(%s)(?:\\/\\/(.*))?$",
			nameSubRe, nameSubRe, providerSubRe))
	NameRe = regexp.MustCompile("^" + nameSubRe + "$")
	ProviderRe = regexp.MustCompile("^" + providerSubRe + "$")
	disallowed = map[string]bool{
		"github.com":    true,
		"bitbucket.org": true,
	}
)
type Module struct {
	RawHost      *FriendlyHost
	RawNamespace string
	RawName      string
	RawProvider  string
	RawSubmodule string
}