terraform/backend
James Bardin 7cba68326a always wait for a RunningOperation to return
If the user wishes to interrupt the running operation, only the first
interrupt was communicated to the operation by canceling the provided
context. A second interrupt would start the shutdown process, but not
communicate this to the running operation. This order of event could
cause partial writes of state.

What would happen is that once the command returns, the plugin system
would stop the provider processes. Once the provider processes dies, all
pending Eval operations would return return with an error, and quickly
cause the operation to complete. Since the backend code didn't know that
the process was shutting down imminently, it would continue by
attempting to write out the last known state. Under the right
conditions, the process would exit part way through the writing of the
state file.

Add Stop and Cancel CancelFuncs to the RunningOperation, to allow it to
easily differentiate between the two signals. The backend will then be
able to detect a shutdown and abort more gracefully.

In order to ensure that the backend is not in the process of writing the
state out, the command will always attempt to wait for the process to
complete after cancellation.
2018-02-12 11:56:03 -05:00
..
atlas backend/atlas: accept ATLAS_ADDRESS env var for address 2017-03-16 23:04:07 -07:00
init Migrate Manta Remote state to be a backend 2017-10-30 18:36:50 +02:00
legacy Make backcend/legacy match new Backend iface 2017-02-28 16:35:45 -05:00
local always wait for a RunningOperation to return 2018-02-12 11:56:03 -05:00
remote-state Merge pull request #17086 from hashicorp/jbardin/GH-17083 2018-01-17 18:51:43 -05:00
backend.go always wait for a RunningOperation to return 2018-02-12 11:56:03 -05:00
cli.go cli: allow disabling "next steps" message in terraform plan 2017-09-14 10:51:41 -07: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 Update various files for new version of "stringer" 2017-12-11 13:26:29 -08:00
testing.go verify that a state can be read even when locked 2017-12-06 18:33:59 -05:00