terraform/backend/remote-state
James Bardin bcb11f6d89 have the consul client manage the lock session
When a consul lock is lost, there is a possibility that the associated
session is still active. Most commonly, the long request to watch the
lock key may error out, while the session is continually refreshed at a
rate of TTL/2.

First have the lock monitor retry the lock internally for at least 10
seconds (5 attempts with the default 2 second wait time). In most cases
this will reconnect on the first try, keeping the lock channel open.

If the consul lock can't recover itself, then cancel the session as soon
as possible (terminating the PreiodicRenew will call Session.Destroy),
and start over. In the worse case, the consul agents were split, and the
session still exists on the leader so we may need to wait for the old
session TTL, plus the LockWait time to renew the lock.

We use a Context for the cancellation channels here, because that
removes the need to worry about double-closes and nil channels. It
requires an awkward adapter goroutine for now to convert the Done()
`<-chan` to a `chan` for PeriodicRenew, but makes the rest of the code
safer in the long run.
2017-07-14 14:42:42 -04:00
..
consul have the consul client manage the lock session 2017-07-14 14:42:42 -04:00
inmem update remote-state/inmem client 2017-02-28 16:35:45 -05:00
s3 Merge pull request #15370 from rowleyaj/s3_backend_workspaces 2017-06-27 11:44:12 -04:00
swift Rename openstack provider for swift remote backend 2017-06-13 22:11:16 +01:00
backend.go update remote-state.Backend 2017-02-28 16:35:45 -05:00
backend_test.go backend/remote-state 2017-01-26 14:33:49 -08:00
testing.go Move TestRemoteLocks to state/remote 2017-02-08 11:25:52 -05:00