From d3f7edeb272a9de29166384aea52e9bd12dbbaf4 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 23 Feb 2018 11:22:28 -0500 Subject: [PATCH] add backend.Operation.StateLocker Add the StateLocker field so that the state lock can be carried between the different function scopes of the backend code. This will allow the backend context to lock the state before it's read, while allowing the different operations to unlock the state when they complete. --- backend/backend.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/backend.go b/backend/backend.go index f67d60ab60..dfeb80ef6f 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -9,6 +9,7 @@ import ( "errors" "time" + "github.com/hashicorp/terraform/command/clistate" "github.com/hashicorp/terraform/config/module" "github.com/hashicorp/terraform/state" "github.com/hashicorp/terraform/terraform" @@ -135,6 +136,10 @@ type Operation struct { // state.Lockers for its duration, and Unlock when complete. LockState bool + // StateLocker is used to lock the state while providing UI feedback to the + // user. This will be supplied by the Backend itself. + StateLocker clistate.Locker + // The duration to retry obtaining a State lock. StateLockTimeout time.Duration