terraform: some basic validation
This commit is contained in:
parent
8aa8d2183e
commit
fceea12ade
|
@ -77,6 +77,10 @@ type GraphNodeResourceProvider struct {
|
|||
// configured at this point.
|
||||
//
|
||||
func Graph(opts *GraphOpts) (*depgraph.Graph, error) {
|
||||
if opts.Config == nil {
|
||||
return nil, errors.New("Config is required for Graph")
|
||||
}
|
||||
|
||||
g := new(depgraph.Graph)
|
||||
|
||||
// First, build the initial resource graph. This only has the resources
|
||||
|
|
|
@ -21,6 +21,12 @@ func TestGraph(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGraph_configRequired(t *testing.T) {
|
||||
if _, err := Graph(new(GraphOpts)); err == nil {
|
||||
t.Fatal("should error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGraph_cycle(t *testing.T) {
|
||||
config := testConfig(t, "graph-cycle")
|
||||
|
||||
|
|
Loading…
Reference in New Issue