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

Interpolate variable during Input and Validate #6833

Merged
merged 3 commits into from
May 24, 2016

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented May 23, 2016

fixes #5322

jbardin added 2 commits May 23, 2016 13:44
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.
Adding walkValidate to the EvalTree operations, and removing the
walkValidate guard from the Interpolater.valueModuleVar allows the
values to be interpolated for Validate.
@jen20
Copy link
Contributor

jen20 commented May 23, 2016

LGTM @jbardin! 🎉

Type: ast.TypeString,
}
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'd do here is walk back to the PR / commit where this stanza was introduced and determine what the intent was just to double check that we're not reversing some prior decision.

The test suite should cover us, so the fact that everything is passing is probably enough, but I think for such a subtle area of the code base it's worth it to do extra due diligence.

Let me know what the git archeology turns up!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior was introduced in PR #432.
The latter test still exists, and the first test was removed via PR #2479.

I wanted to make sure this case was handled, and it is!

So here's an extra test for us.
@phinze
Copy link
Contributor

phinze commented May 23, 2016

We hashed this out in Slack, I submitted one extra test case I was concerned about. If you pull that into your branch this LGTM for merge! 🚢

@jbardin jbardin force-pushed the jbardin/fix-interpolation branch from c961446 to b205ac2 Compare May 24, 2016 14:15
@jbardin jbardin merged commit 3f71976 into master May 24, 2016
@jbardin jbardin deleted the jbardin/fix-interpolation branch May 24, 2016 14:19
@ddegoede
Copy link
Contributor

ddegoede commented Jun 21, 2016

@jbardin @phinze , should this be fixed in 0.7.0rc2? I think I am running into this issue, and if I replace the parameter with the actual contents of the module output, it works fine.

I am using the output of one module as input for another module, and then I get this error on the count:

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

module "vpc" {
    source        = "../../_MODULES/VPC"
    globals       = "${var.globals}"
    cs            = "${var.cloud_build}"
    vpcs          = "${var.vpcs}"
    vpc_cidrs     = "${var.vpc_cidrs}"
    network_cidrs = "${var.network_cidrs}"
}

module "bastion_ip" {
    source        = "../../_MODULES/PUBLICIP"
    cs            = "${var.cloud_build}"
    vpc_id        = "${module.vpc.vpc_id}"
}

@jbardin
Copy link
Member Author

jbardin commented Jun 21, 2016

@ddegoede, yes that patch should be in rc2. I wonder if this is somehow a different manifestation of the same problem.

Can you provide a standalone example that reproduces this in a new issue? Thanks!

@ddegoede
Copy link
Contributor

@jbardin I created an new issue for my error with TF plan and modules

@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 this pull request may close these issues.

Syntax error interpolating count attribute when value passed between modules
4 participants