-
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
Dependencies aren't honored for Update #1123
Comments
Thanks, well take a look at reproducing this. There must be something really strange here because the create/update graph is identical: we build logical graphs that don't depend on the operation. The walk order should be the same. But I'll take a look. |
I'm having trouble reproducing this. I wrote a couple test cases really quickly here and I'm seeing good behavior all around. The test cases I have (that work properly):
Can you get me a minimal example that has the full normal steps of:
And logs for all of those? I can't continue without it since its not obvious to me. Thanks! |
@mitchellh just narrowed some stuff down with @phinze and did more testing and it appears that this only happens when the computed value is updated in Update. If the value is updated in Read, everything behaves normally. As a corollary this means it can only be tested by ensuring that the value is only updated in Update. |
@jefferai I think this comes back to: does the plan say it is going to be updated? The plan must reflect that the update will happen. |
On the first run, no. If I change some (non-computed) value in Resource A, Certainly I can understand why It seems like there is a tradeoff here: either committing to idempotency and re-checking other resources that have dependencies on computed values (or simply deferring read/update on those until after the resources they depend on are finished updating), or committing to the stated plan. Personally I'd prefer the former, with a warning when running |
@mitchellh After discussion with @phinze he suggested highlighting/bumping this to ensure that the description in the above comment was noticed (since it is marked waiting for response). If what I described above doesn't match with how you think Terraform behaves I can work up a test case. |
Actually, FWIW, right now I'm not running into this behavior. When I run plan/apply, I see many of my resources being refreshed, a tiny pause, and the other two resources that depend on earlier ones then are refreshed. I don't know if it's due to rebasing on later versions of terraform that had changes or what, but I will close this up until some time I can reliably reproduce it. |
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. |
Given a dependency from one resource on another, such that you have the following in your config/state file:
this dependency is only honored at Create time, but not Update time.
This becomes a problem if Resource A (RA) is depending on a Computed schema entry from Resource B (RB). If RB's entry is updated due to actions taking place in its Update method (which seems reasonable for Computed entries), RA's Read/Update methods may have already been run. In this case, RA will not perform the action it needs to perform (reacting to the update to the Computed value it depends on) until the next time
terraform apply
is run.The text was updated successfully, but these errors were encountered: