-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
template_file resource "primary" ends up null in tfstate file #2939
Comments
I have run into this quite a few times, and I'm not sure how to reproduce. I have fixed/resolved the issue with manual tweaks to the state file, though I do not (right now) remember what those updates were. |
@phinze / @mitchellh, Could this be a bug with resource dependency resolution? It seems as though it is. I have a
...when I leave the
Carefully using the knowledge noted above, particularly with |
I've also just run into this issue, it does seem related to resource dependencies when using raw resources, who's values are passed to modules. I get it when trying to create a Route 53 DNS record (I have a DNS module for reuse) that depends on ELB endpoint value from a resource that's not a module. It seems the only way to guarantee that the right order of creation is either, make everything a resource in a flat way (no modules) and explicitly handle the depends, or make EVERYTHING a module. Is depends_on going to add module -> resource, resource -> module bindings in the future? |
This definitely has the feel of a core bug. Tagged as such. If anybody managed to get this narrowed down to a repro case please do share! In the meantime I'll keep an eye out for it in personal TF usage and report back if I can reproduce. |
Looks like #3182 has a reproducible relevant scenario which should help us get some debugging done. 👍 |
@phinze I would share more code, but it is a bit buried in code that is not yet open-sourced. I will see if I can reproduce the bug with one of my modules that could be more easily shared. Glad to see we have some traction either way! |
@phinze, would it help if I spent the time to get some code online for you, based on what I am doing? Looking over the code in the referenced issue, I might be doing something functionally the same within Terraform (to trip the same bug), but my code and logic is different. In short: I have a bunch of TF modules which accept a |
On a related note, when I issue a
|
Ran into this issue today, after a successful deploy, the primary field had been written out to file as null, had to substitute in an old deposed section of json. |
#3182 is fixed which we felt this was related to, and there are other newer issues that have simiar error messages. Because there is no clean repro here and its been so long I'm going to close this issue and move on to the newer ones. If you see it again please open an issue and please try to get a repro! Note that "lost state" would be a top top priority issue in any case so any repro will be prioritized. At this point there we aren't hearing of these issues. |
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. |
We are using TF in a team setting, and one of my co-workers ended up getting his tfstate file like this yesterday:
Unfortunately, I have no idea how he did this, but it took me about an hour to figure out because literally every TF command I tried ended up spitting out
The solution was to go in and manually edit the
.tfstate
file, I moved an old deposed template resource into the primary and everything started working again.Again, I cannot reproduce, but just wanted to document this happening in case it pops up again.
The text was updated successfully, but these errors were encountered: