From 8420b580157f8c2046b1abfaa6c8afa670b90096 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 24 Sep 2014 19:36:00 -0700 Subject: [PATCH] terraform: clean up some functions --- terraform/context.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/terraform/context.go b/terraform/context.go index 1d7bd9c3b..c49a1384d 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -117,7 +117,13 @@ func (c *Context) Apply() (*State, error) { // Graph returns the graph for this context. func (c *Context) Graph() (*depgraph.Graph, error) { - return c.graph() + return Graph(&GraphOpts{ + Diff: c.diff, + Module: c.module, + Providers: c.providers, + Provisioners: c.provisioners, + State: c.state, + }) } // Plan generates an execution plan for the given context. @@ -248,16 +254,6 @@ func (c *Context) Validate() ([]string, []error) { return walkMeta.Warns, errs } -func (c *Context) graph() (*depgraph.Graph, error) { - return Graph(&GraphOpts{ - Diff: c.diff, - Module: c.module, - Providers: c.providers, - Provisioners: c.provisioners, - State: c.state, - }) -} - func (c *Context) acquireRun() chan<- struct{} { c.l.Lock() defer c.l.Unlock() @@ -389,6 +385,11 @@ func (c *walkContext) Walk() error { return err } + if c.Operation == walkValidate { + // Validation is the only one that doesn't calculate outputs + return nil + } + // We did an apply, so we need to calculate the outputs. If we have no // outputs, then we're done. m := c.Context.module