mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
f2adfb6e2a
In many ways a deposed object is equivalent to an orphaned current object in that the only action we can take with it is to destroy it. However, we do still need to take some preparation steps in both cases: first, we must ensure we track the upgraded version of the existing object so that we'll be able to successfully render our plan, and secondly we must refresh the existing object to make sure it still exists in the remote system. We were previously doing these extra steps for orphan objects but not for deposed ones, which meant that the behavior for deposed objects would be subtly different and violate the invariants our callers expect in order to display a plan. This also created the risk that a deposed object already deleted in the remote system would become "stuck" because Terraform would still plan to destroy it, which might cause the provider to return an error when it tries to delete an already-absent object. This also makes the deposed object planning take into account the "skipPlanChanges" flag, which is important to get a correct result in the "refresh only" planning mode. It's a shame that we have almost identical code handling both the orphan and deposed situations, but they differ in that the latter must call different functions to interact with the deposed rather than the current objects in the state. Perhaps a later change can improve on this with some more refactoring, but this commit is already a little more disruptive than I'd like and so I'm intentionally deferring that for another day. |
||
---|---|---|
.. | ||
json | ||
apply_test.go | ||
apply.go | ||
hook_count_test.go | ||
hook_count.go | ||
hook_json_test.go | ||
hook_json.go | ||
hook_ui_test.go | ||
hook_ui.go | ||
json_view_test.go | ||
json_view.go | ||
operation_test.go | ||
operation.go | ||
output_test.go | ||
output.go | ||
plan_test.go | ||
plan.go | ||
refresh_test.go | ||
refresh.go | ||
show.go | ||
state_locker.go | ||
test_test.go | ||
test.go | ||
validate_test.go | ||
validate.go | ||
view.go |