Merge pull request #12778 from hashicorp/jbardin/GH-12741
change to default state after backend migration
This commit is contained in:
commit
9bfa361e21
|
@ -183,6 +183,10 @@ func (m *Meta) backendMigrateState_S_s(opts *backendMigrateOpts) error {
|
||||||
|
|
||||||
// Copy the default state
|
// Copy the default state
|
||||||
opts.oneEnv = currentEnv
|
opts.oneEnv = currentEnv
|
||||||
|
|
||||||
|
// now switch back to the default env so we can acccess the new backend
|
||||||
|
m.SetEnv(backend.DefaultStateName)
|
||||||
|
|
||||||
return m.backendMigrateState_s_s(opts)
|
return m.backendMigrateState_s_s(opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1144,6 +1144,11 @@ func TestMetaBackend_configuredChangeCopy_multiToSingle(t *testing.T) {
|
||||||
if _, err := os.Stat(envPath); err != nil {
|
if _, err := os.Stat(envPath); err != nil {
|
||||||
t.Fatal("env should exist")
|
t.Fatal("env should exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify we are now in the default env, or we may not be able to access the new backend
|
||||||
|
if env := m.Env(); env != backend.DefaultStateName {
|
||||||
|
t.Fatal("using non-default env with single-env backend")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changing a configured backend that supports multi-state to a
|
// Changing a configured backend that supports multi-state to a
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
env1
|
Loading…
Reference in New Issue