Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error interpolating count attribute when value passed between modules #5322

Closed
phinze opened this issue Feb 25, 2016 · 4 comments · Fixed by #6833
Closed

Syntax error interpolating count attribute when value passed between modules #5322

phinze opened this issue Feb 25, 2016 · 4 comments · Fixed by #6833

Comments

@phinze
Copy link
Contributor

phinze commented Feb 25, 2016

From a report on the Terraform mailing list.

Repro config

# main.tf
module "source" {
  source = "./source"
}
module "child" {
  source  = "./child"
  list = "${module.source.list}"
}

# source/main.tf
output "list" { value = "foo,bar,baz" }

# child/main.tf
variable "list" { }
resource "template_file" "temp" {
  count     = "${length(split(",", var.list))}"
  template  = "foo"
}

Steps

Run terraform plan.

Expected behavior

A plan to create 3 templates.

Observed behavior

Error configuring: 1 error(s) occurred:

* strconv.ParseInt: parsing "${length(split(\",\", var.list))}": invalid syntax

Related issues:

This might actually be a dupe of one of those, but I wanted to get this repro out there. 👍

@dbrandt
Copy link

dbrandt commented Mar 29, 2016

This is biting me right now. I'm trying to start up one EC2 instance in every availability zone with output from tf_aws_availability_zones but running into this parse error instead, forcing me to use hard coded values.

@ghost
Copy link

ghost commented Apr 7, 2016

Any update on this?

Thanks!

@clstokes
Copy link
Contributor

Related to #4703 too maybe?

jbardin added a commit that referenced this issue May 23, 2016
Variables weren't being interpolated during the Input phase, causing a
syntax error on the interpolation string. Adding `walkInput` to the
EvalTree operations prevents skipping the interpolation step.

Fixes #5322
@ghost
Copy link

ghost commented Apr 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants