@@ -649,11 +649,13 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di
649649 // Get the local 'backend' or 'state_store' configuration.
650650 var backendConfig * configs.Backend
651651 var stateStoreConfig * configs.StateStore
652- var cHash int
652+ var cHash int // backend hash
653+ var stateStoreHash int
654+ var stateStoreProviderHash int
653655 if opts .StateStoreConfig != nil {
654656 // state store has been parsed from config and is included in opts
655657 var ssDiags tfdiags.Diagnostics
656- stateStoreConfig , cHash , _ , ssDiags = m .stateStoreConfig (opts )
658+ stateStoreConfig , stateStoreHash , stateStoreProviderHash , ssDiags = m .stateStoreConfig (opts )
657659 diags = diags .Append (ssDiags )
658660 if ssDiags .HasErrors () {
659661 return nil , diags
@@ -820,7 +822,7 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di
820822 return nil , diags
821823 }
822824
823- return m .stateStore_C_s (stateStoreConfig , cHash , sMgr , opts )
825+ return m .stateStore_C_s (stateStoreConfig , stateStoreHash , stateStoreProviderHash , sMgr , opts )
824826
825827 // Migration from state store to backend
826828 case backendConfig != nil && s .Backend .Empty () &&
@@ -1498,7 +1500,7 @@ func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, backendSMgr
14981500//-------------------------------------------------------------------
14991501
15001502// Configuring a state_store for the first time.
1501- func (m * Meta ) stateStore_C_s (c * configs.StateStore , cHash int , backendSMgr * clistate.LocalState , opts * BackendOpts ) (backend.Backend , tfdiags.Diagnostics ) {
1503+ func (m * Meta ) stateStore_C_s (c * configs.StateStore , stateStoreHash int , providerHash int , backendSMgr * clistate.LocalState , opts * BackendOpts ) (backend.Backend , tfdiags.Diagnostics ) {
15021504 var diags tfdiags.Diagnostics
15031505
15041506 vt := arguments .ViewJSON
@@ -1584,7 +1586,7 @@ func (m *Meta) stateStore_C_s(c *configs.StateStore, cHash int, backendSMgr *cli
15841586 if m .stateLock {
15851587 view := views .NewStateLocker (vt , m .View )
15861588 stateLocker := clistate .NewLocker (m .stateLockTimeout , view )
1587- if err := stateLocker .Lock (backendSMgr , "state_store from plan " ); err != nil {
1589+ if err := stateLocker .Lock (backendSMgr , "init is initializing state_store first time " ); err != nil {
15881590 diags = diags .Append (fmt .Errorf ("Error locking state: %s" , err ))
15891591 return nil , diags
15901592 }
@@ -1633,10 +1635,11 @@ func (m *Meta) stateStore_C_s(c *configs.StateStore, cHash int, backendSMgr *cli
16331635 }
16341636 s .StateStore = & workdir.StateStoreConfigState {
16351637 Type : c .Type ,
1636- Hash : uint64 (cHash ),
1638+ Hash : uint64 (stateStoreHash ),
16371639 Provider : & workdir.ProviderConfigState {
16381640 Source : & c .ProviderAddr ,
16391641 Version : pVersion ,
1642+ Hash : uint64 (providerHash ),
16401643 },
16411644 }
16421645 s .StateStore .SetConfig (storeConfigVal , b .ConfigSchema ())
0 commit comments