func (t *Tree) Modules() []*Module {
	result := make([]*Module, len(t.config.Modules))
	for i, m := range t.config.Modules {
		result[i] = &Module{
			Name:   m.Name,
			Source: m.Source,
		}
	}
	return result
}
Modules returns the list of modules that this tree imports.

This is only the imports of _this_ level of the tree. To retrieve the
full nested imports, you'll have to traverse the tree.
package module
import (
	"bufio"
	"bytes"
	"fmt"
	"path/filepath"
	"strings"
	"sync"
	"github.com/hashicorp/go-getter"
	"github.com/hashicorp/terraform/config"
)
const RootName = "root"
type Tree struct {
	name     string
	config   *config.Config
	children map[string]*Tree
	path     []string
	lock     sync.RWMutex
}
func NewTree(name string, c *config.Config) *Tree {
	return &Tree{config: c, name: name}
}
func NewEmptyTree() *Tree {
	t := &Tree{config: &config.Config{}}
	if err := t.Load(nil, GetModeGet); err != nil {
		panic(err)
	}
	return t
}
func NewTreeModule(name, dir string) (*Tree, error) {
	c, err := config.LoadDir(dir)
	if err != nil {
		return nil, err
	}
	return NewTree(name, c), nil
}
func (t *Tree) Config() *config.Config {
	return t.config
}
func (t *Tree) Child(path []string) *Tree {
	if t == nil {
		return nil
	}
	if len(path) == 0 {
		return t
	}
	c := t.Children()[path[0]]
	if c == nil {
		return nil
	}
	return c.Child(path[1:])
}
func (t *Tree) Children() map[string]*Tree {
	t.lock.RLock()
	defer t.lock.RUnlock()
	return t.children
}
func (t *Tree) Loaded() bool {
	t.lock.RLock()
	defer t.lock.RUnlock()
	return t.children != nil
}