-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
error using variables exported from one module in another #659
Comments
Sorry, forgot to mention this is with 0.3.5 on OS X 10.10.2 |
Looks like this is the commit that broke things e82a285 . Seem like error checking is causing it have unwanted errors. |
I can confirm that rolling back to ca48dca works. |
Thanks for the repro case, hopefully we can dive in soon. The commit in question actually just adds error checking for some of the internal methods. Previously, we weren't checking for certain interpolation errors which caused other crashes / panics. The fact that errors are now cropping up means we were masking bugs previously. |
Long and I were discussing that. I was - without actually looking at or understanding the code - propositioning that it was possible the error checking itself was the cause of the problem, if it was looking for a variable that wouldn't be there until it was applying (i.e, a variable derived from another variable that is marked as 'calculated'). But you know your code better than I do (obviously). Let me know if there is anything I can do to help track this down. |
I hit a this issue too. Running "terraform apply -refresh=false" worked around the problem, but this may not always be the right thing to do. |
Reproduced, super good repro steps, thanks! |
I've got a fix... I just can't get a reproducing unit test, which is blocking the fix right now. Ugh! Working on that. |
Fixed! |
Thanks!! |
Yes, thank you very much! |
@mitchellh Hrrm. I'm running HEAD with the fix, and I don't get the same error I got before (i.e.,
I've tried it a few times and get the same problem each time. Can you run through the repro steps I listed before and see if you are able to successfully |
I should say, when running ca48dca not only did |
If you think this is a problem with something else, unrelated to the changes you made, let me know and I'll open a different ticket. |
I'll reopen to look at this. The issue with the commit passed ca48dca was it was failing, we just weren't surfacing the error. The fact it happened to work down the road was purely coincidental and was just covering bugs. We're fixing this properly now (with unit tests) and will get to a stable point for this. |
@teancom I think this might be fixed? I just ran from master and got a successful apply. Can you try again? I'll also try again to see if maybe this is a race of some sort... |
Maybe you ran Terraform just before the compile finished? :) I dunno. I found a couple other bugs I'm fixing now related to this. |
No, the obvious correct answer is that this bug only affects people in the mid-afternoon, EST, when they haven't had their nap. |
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. |
The problem
I have two terraform modules - one to create a VPC, a couple subnets and a nat server, the other to create three more subnets and an elastic IP (this is all in the service of creating a flexible system for installing Cloud Foundry). However, when I try and use the two modules together, using some
output
s from the first as variables in the second (VPC id, route tables, availability zones), it fails. Oddly enough, it fails complaining about a different variable each time, like there's a race condition or a hash that's in a different order.Error output
However, like I said, the variable in question changes almost every time. Running that again, I get:
Error refreshing state: Module 'vpc' not found for variable 'module.vpc.aws_route_table_public_id'
Then I get that two more times in a row, then:
Error refreshing state: Module 'vpc' not found for variable 'module.vpc.aws_internet_gateway_id'
To reproduce
git clone https://github.com/teancom/terraform-test
cp terraform.tfvars-example terraform.tfvars
terraform.tfvars
in with valid valuesmake plan
Workaround / Possible Clue
The modules work if you comment out the
cf
module completely, runmake plan
and thenmake apply
, wait for it to successfully complete, and then uncomment thecf
module and run terraform again.The text was updated successfully, but these errors were encountered: