terraform: guard against a nil resource

This commit is contained in:
Mitchell Hashimoto 2014-10-02 22:24:01 -07:00
parent 23285aed76
commit 1ddf5bfc5f
1 changed files with 3 additions and 1 deletions

View File

@ -1415,7 +1415,9 @@ func (c *walkContext) computeVars(
case *config.CountVariable:
switch v.Type {
case config.CountValueIndex:
vs[n] = strconv.FormatInt(int64(r.CountIndex), 10)
if r != nil {
vs[n] = strconv.FormatInt(int64(r.CountIndex), 10)
}
}
case *config.ModuleVariable:
value, err := c.computeModuleVariable(v)