diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c31d148..f36c7b8a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ ## 0.3.1 (unreleased) +BUG FIXES: + * core: Remove panic case when applying with a plan that generates no + new state. [GH-403] ## 0.3.0 (October 14, 2014) diff --git a/terraform/context.go b/terraform/context.go index 82e82de59..5dff77d40 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -517,13 +517,13 @@ func (c *walkContext) Walk() error { // Likewise, if we have no resources in our state, we're done. This // guards against the case that we destroyed. mod := c.Context.state.ModuleByPath(c.Path) + if mod == nil { + return nil + } if c.Operation == walkApply { // On Apply, we prune so that we don't do outputs if we destroyed mod.prune() } - if mod == nil || len(mod.Resources) == 0 { - return nil - } if len(mod.Resources) == 0 { mod.Outputs = nil return nil