From 1ddf5bfc5f44f98b60fe372b159eaeecc79ab62d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Oct 2014 22:24:01 -0700 Subject: [PATCH] terraform: guard against a nil resource --- terraform/context.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/terraform/context.go b/terraform/context.go index 95102cc80..894e906c8 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -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)