opentofu/state
Lee Trout cb0e20ca2b Add support for force pushing with the remote backend
Both differing serials and lineage protections should be bypassed
with the -force flag (in addition to resources).

Compared to other backends we aren’t just shipping over the state
bytes in a simple payload during the persistence phase of the push
command and the force flag added to the Go TFE client needs to be
specified at that time.

To prevent changing every method signature of PersistState of the
remote client I added an optional interface that provides a hook
to flag the Client as operating in a force push context. Changing
the method signature would be more explicit at the cost of not
being used anywhere else currently or the optional interface pattern
could be applied to the state itself so it could be upgraded to
support PersistState(force bool) only when needed.

Prior to this only the resources of the state were checked for
changes not the lineage or the serial. To bring this in line with
documented behavior noted above those attributes also have a “read”
counterpart just like state has. These are now checked along with
state to determine if the state as a whole is unchanged.

Tests were altered to table driven test format and testing was
expanded to include WriteStateForMigration and its interaction
with a ClientForcePusher type.
2020-05-06 12:07:43 -04:00
..
remote Add support for force pushing with the remote backend 2020-05-06 12:07:43 -04:00
testdata Use NewLockInfo to get a pre-populated value 2017-02-15 14:41:55 -05:00
backup.go terraform: Ugly huge change to weave in new State and Plan types 2018-10-16 19:11:09 -07:00
inmem.go state: more robust handling of state Serial 2017-07-05 12:34:30 -07:00
local_lock_unix.go Use io.SeekStart instead of deprecated os.SEEK_SET 2018-02-25 23:11:40 +01:00
local_lock_windows.go fix windows locking 2017-02-17 13:29:48 -05:00
local.go state: update local unlock err (#24320) 2020-03-17 14:01:51 -04:00
lock_test.go backend/consul: support "lock" option to disable locking 2017-03-14 17:59:10 -07:00
lock.go terraform: Ugly huge change to weave in new State and Plan types 2018-10-16 19:11:09 -07:00
state_test.go state: Remove tests for obsolete components 2018-10-16 19:14:11 -07:00
state.go remove single rand source to prevent races 2019-02-21 20:45:41 -05:00
testing.go terraform: Ugly huge change to weave in new State and Plan types 2018-10-16 19:11:09 -07:00