terraform: Graph returns *Graph for now
This commit is contained in:
parent
7552abed8b
commit
b1e5b32322
|
@ -5,8 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/terraform"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GraphCommand is a Command implementation that takes a Terraform
|
// GraphCommand is a Command implementation that takes a Terraform
|
||||||
|
@ -58,11 +56,7 @@ func (c *GraphCommand) Run(args []string) int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := &terraform.GraphDotOpts{
|
c.Ui.Output(g.String())
|
||||||
ModuleDepth: moduleDepth,
|
|
||||||
}
|
|
||||||
|
|
||||||
c.Ui.Output(terraform.GraphDot(g, opts))
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ func TestGraph(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
output := ui.OutputWriter.String()
|
output := ui.OutputWriter.String()
|
||||||
if !strings.Contains(output, "digraph {") {
|
if !strings.Contains(output, "provider.test") {
|
||||||
t.Fatalf("doesn't look like digraph: %s", output)
|
t.Fatalf("doesn't look like digraph: %s", output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ func TestGraph_noArgs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
output := ui.OutputWriter.String()
|
output := ui.OutputWriter.String()
|
||||||
if !strings.Contains(output, "digraph {") {
|
if !strings.Contains(output, "provider.test") {
|
||||||
t.Fatalf("doesn't look like digraph: %s", output)
|
t.Fatalf("doesn't look like digraph: %s", output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ func TestGraph_plan(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
output := ui.OutputWriter.String()
|
output := ui.OutputWriter.String()
|
||||||
if !strings.Contains(output, "digraph {") {
|
if !strings.Contains(output, "provider.test") {
|
||||||
t.Fatalf("doesn't look like digraph: %s", output)
|
t.Fatalf("doesn't look like digraph: %s", output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// GraphBuilder returns the GraphBuilder that will be used to create
|
||||||
// the graphs for this context.
|
// the graphs for this context.
|
||||||
func (c *Context) GraphBuilder() GraphBuilder {
|
func (c *Context) GraphBuilder() GraphBuilder {
|
||||||
|
|
Loading…
Reference in New Issue