terraform: don't panic if no state in Walk return [GH-403]

This commit is contained in:
Mitchell Hashimoto 2014-10-15 20:32:19 -07:00
parent 2a388fd5d1
commit 5596ee7f53
2 changed files with 6 additions and 3 deletions

View File

@ -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)

View File

@ -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