terraform: Graph returns *Graph for now

This commit is contained in:
Mitchell Hashimoto 2015-02-13 18:22:08 -08:00
parent 7552abed8b
commit b1e5b32322
3 changed files with 9 additions and 10 deletions

View File

@ -5,8 +5,6 @@ import (
"fmt"
"os"
"strings"
"github.com/hashicorp/terraform/terraform"
)
// GraphCommand is a Command implementation that takes a Terraform
@ -58,11 +56,7 @@ func (c *GraphCommand) Run(args []string) int {
return 1
}
opts := &terraform.GraphDotOpts{
ModuleDepth: moduleDepth,
}
c.Ui.Output(terraform.GraphDot(g, opts))
c.Ui.Output(g.String())
return 0
}

View File

@ -26,7 +26,7 @@ func TestGraph(t *testing.T) {
}
output := ui.OutputWriter.String()
if !strings.Contains(output, "digraph {") {
if !strings.Contains(output, "provider.test") {
t.Fatalf("doesn't look like digraph: %s", output)
}
}
@ -73,7 +73,7 @@ func TestGraph_noArgs(t *testing.T) {
}
output := ui.OutputWriter.String()
if !strings.Contains(output, "digraph {") {
if !strings.Contains(output, "provider.test") {
t.Fatalf("doesn't look like digraph: %s", output)
}
}
@ -99,7 +99,7 @@ func TestGraph_plan(t *testing.T) {
}
output := ui.OutputWriter.String()
if !strings.Contains(output, "digraph {") {
if !strings.Contains(output, "provider.test") {
t.Fatalf("doesn't look like digraph: %s", output)
}
}

View File

@ -95,6 +95,11 @@ func NewContext(opts *ContextOpts) *Context {
}
}
// Graph returns the graph for this config.
func (c *Context) Graph() (*Graph, error) {
return c.GraphBuilder().Build(RootModulePath)
}
// GraphBuilder returns the GraphBuilder that will be used to create
// the graphs for this context.
func (c *Context) GraphBuilder() GraphBuilder {