terraform/backend
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
..
atlas backend/atlas: accept ATLAS_ADDRESS env var for address 2017-03-16 23:04:07 -07:00
init remote/swift: Migrate Swift remote state to a backend 2017-06-13 22:04:01 +01:00
legacy Make backcend/legacy match new Backend iface 2017-02-28 16:35:45 -05:00
local command: minor adjustments to the -auto-approve=false UX 2017-06-27 11:22:35 -07:00
remote-state have the consul client manage the lock session 2017-07-14 14:42:42 -04:00
backend.go command: also print plan for destroy 2017-06-27 11:22:31 -07:00
cli.go command: use backend.CLIIinit 2017-02-28 10:58:29 -08:00
nil.go Update Backend interface to latest iteration 2017-02-28 16:07:07 -05:00
nil_test.go backend: introduce the backend set of interfaces 2017-01-26 14:33:49 -08:00
operation_type.go backend: introduce the backend set of interfaces 2017-01-26 14:33:49 -08:00
operationtype_string.go Fix stringer comments (#15069) 2017-06-05 10:17:35 +01:00
testing.go add named named state delete+create-delete test 2017-06-23 10:16:34 -04:00