mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-23 22:00:35 -04:00
This is the first half of solving the current problem that we're not always properly respecting the reverse dependency edges while destroying objects: we need to consider both the config-derived dependencies and the dependencies recorded in the the previous run state together when building the resource instance graph. The "orphan" case is the most obvious way this manifests right now, but this needs handling in the desired case too because the desired case is what handles "replace" actions, which include a delete component that also needs to respect these prior dependencies. The other half of this problem is that we're not actually currently propagating the dependency information to the apply phase, and so it's not saving that information in the new state objects it creates. That's not solved in this commit, and instead I just tested this by manually modifying the prior state to include what ought to have been recorded in it and then verified that caused a correct execution graph to be constructed. I intend to deal with the apply-time part of this problem in a separate commit later. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>