opentofu/backend
Martin Atkins f2adfb6e2a core: Treat deposed objects the same as orphaned current objects
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.
2021-05-13 09:05:06 -07:00
..
init backend: remove deprecated atlas backend 2020-10-26 14:05:18 -04:00
local core: Treat deposed objects the same as orphaned current objects 2021-05-13 09:05:06 -07:00
remote command+backend/local: -refresh-only and drift detection 2021-05-13 09:05:06 -07:00
remote-state Add config_paths and drop KUBECONFIG env variable in kubernetes backend (#26997) 2021-04-20 10:05:45 -04:00
backend_test.go helper: deprecate pathorcontents 2020-10-08 08:42:16 -04:00
backend.go core: Minimal initial implementation of -replace=... option 2021-04-30 10:30:56 -07:00
cli.go backend: Replace ShowDiagnostics with view.Diagnostics 2021-02-25 11:26:05 -05:00
operation_type.go Version tools per Go convention under tools.go 2019-10-17 22:23:39 +02:00
operationtype_string.go stringer: Regenerate files with latest version 2019-05-13 15:34:27 +01:00
testing.go call the InConfigBody with addresses 2021-04-06 15:15:52 -04:00
unparsed_value_test.go Remove deprecation on undeclared variable, docs, and summary adjustment (#27795) 2021-02-18 11:11:52 -05:00
unparsed_value.go Remove deprecation on undeclared variable, docs, and summary adjustment (#27795) 2021-02-18 11:11:52 -05:00