Fix for multivars when modulestate not created yet

pull/620/head
Luke Amdor 12 years ago
parent 5d89cae1d7
commit fead5872e5

@ -1705,7 +1705,6 @@ func (c *walkContext) computeResourceMultiVariable(
}
// Get the relevant module
// TODO: Not use only root module
module := c.Context.state.ModuleByPath(c.Path)
count, err := cr.Count()
@ -1716,8 +1715,8 @@ func (c *walkContext) computeResourceMultiVariable(
err)
}
// If we have no count, return empty
if count == 0 {
// If we have no module in the state yet or count, return empty
if module == nil || count == 0 {
return "", nil
}

@ -844,6 +844,9 @@ STATE:
const testTerraformPlanModuleMultiVarStr = `
DIFF:
CREATE: aws_instance.parent.0
CREATE: aws_instance.parent.1
module.child:
CREATE: aws_instance.bar.0
baz: "" => "baz"

@ -1,3 +1,5 @@
variable "things" {}
resource "aws_instance" "bar" {
baz = "baz"
count = 2

@ -1,4 +1,9 @@
resource "aws_instance" "parent" {
count = 2
}
module "child" {
source = "./child"
source = "./child"
things = "${join(",", aws_instance.bar.*.private_ip)}"
}

Loading…
Cancel
Save