From d0dc045282a1e45687117ef1c6980303740ec7bf Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 8 Jul 2014 16:16:55 -0700 Subject: [PATCH] terraform: make sure the config is initialized --- terraform/graph.go | 10 ++++++---- terraform/resource.go | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/terraform/graph.go b/terraform/graph.go index c952bb4ee5..4cdb5d23ff 100644 --- a/terraform/graph.go +++ b/terraform/graph.go @@ -199,8 +199,9 @@ func graphAddConfigResources( Type: r.Type, Config: r, Resource: &Resource{ - Id: name, - State: state, + Id: name, + State: state, + Config: NewResourceConfig(r.RawConfig), }, }, } @@ -429,8 +430,9 @@ func graphAddOrphans(g *depgraph.Graph, c *config.Config, s *State) { Type: rs.Type, Orphan: true, Resource: &Resource{ - Id: k, - State: rs, + Id: k, + State: rs, + Config: NewResourceConfig(nil), }, }, } diff --git a/terraform/resource.go b/terraform/resource.go index b32071de09..b895935074 100644 --- a/terraform/resource.go +++ b/terraform/resource.go @@ -135,8 +135,11 @@ func (c *ResourceConfig) interpolate(ctx *Context) error { } } - c.ComputedKeys = c.raw.UnknownKeys() - c.Raw = c.raw.Raw - c.Config = c.raw.Config() + if c.raw != nil { + c.ComputedKeys = c.raw.UnknownKeys() + c.Raw = c.raw.Raw + c.Config = c.raw.Config() + } + return nil }