terraform: Stop API added to ResourceProvider

This commit is contained in:
Mitchell Hashimoto 2016-10-23 17:32:09 -07:00
parent 8dcd5881f9
commit 4582c2c016
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 20 additions and 0 deletions

View File

@ -47,6 +47,26 @@ type ResourceProvider interface {
// knows how to manage.
Resources() []ResourceType
// Stop is called when the provider should halt any in-flight actions.
//
// This can be used to make a nicer Ctrl-C experience for Terraform.
// Even if this isn't implemented to do anything (just returns nil),
// Terraform will still cleanly stop after the currently executing
// graph node is complete. However, this API can be used to make more
// efficient halts.
//
// Stop doesn't have to and shouldn't block waiting for in-flight actions
// to complete. It should take any action it wants and return immediately
// acknowledging it has received the stop request. Terraform core will
// automatically not make any further API calls to the provider soon
// after Stop is called (technically exactly once the currently executing
// graph nodes are complete).
//
// The error returned, if non-nil, is assumed to mean that signaling the
// stop somehow failed and that the user should expect potentially waiting
// a longer period of time.
Stop() error
/*********************************************************************
* Functions related to individual resources
*********************************************************************/