From 9594ed6e1cc1244f06a8b05f86a576353b042c74 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Fri, 19 Sep 2014 14:54:21 -0700 Subject: [PATCH] terraform: minor cleanup --- terraform/graph.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/terraform/graph.go b/terraform/graph.go index b833d5a00..b8c16c9e5 100644 --- a/terraform/graph.go +++ b/terraform/graph.go @@ -217,6 +217,9 @@ func EncodeDependencies(g *depgraph.Graph) { // configGraph turns a configuration structure into a dependency graph. func graphAddConfigResources( g *depgraph.Graph, c *config.Config, s *State) { + // TODO: Handle non-root modules + mod := s.ModuleByPath(rootModulePath) + // This tracks all the resource nouns nouns := make(map[string]*depgraph.Noun) for _, r := range c.Resources { @@ -232,12 +235,7 @@ func graphAddConfigResources( index = i } - tainted := false var state *ResourceState - - // TODO: Handle non-root modules - mod := s.ModuleByPath(rootModulePath) - if s != nil && mod != nil { // Lookup the resource state state = mod.Resources[name] @@ -254,11 +252,6 @@ func graphAddConfigResources( state = mod.Resources[r.Id()] } } - - // Determine if this resource is tainted - if state != nil && len(state.Tainted) > 0 { - tainted = true - } } if state == nil { @@ -277,7 +270,7 @@ func graphAddConfigResources( Id: name, State: state, Config: NewResourceConfig(r.RawConfig), - Tainted: tainted, + Tainted: len(state.Tainted) > 0, }, }, }