re-word state migration prompts
The existing prompts were worded as if backend configurations were named, but they can only really be referenced by their type. Change the wording to reference them as type "X backend". When migrating state, refer to the backends as the "previously configured" and "newly configured", since they will often have the same type.
This commit is contained in:
parent
885e4cde81
commit
f45205feb7
|
@ -1023,7 +1023,10 @@ func (m *Meta) backend_C_r_S_changed(
|
|||
"Error initializing new backend: %s", err)
|
||||
}
|
||||
|
||||
// no need to confuse the user if the backend types are the same
|
||||
if s.Backend.Type != c.Type {
|
||||
m.Ui.Output(strings.TrimSpace(fmt.Sprintf(outputBackendMigrateChange, s.Backend.Type, c.Type)))
|
||||
}
|
||||
|
||||
// Grab the existing backend
|
||||
oldB, err := m.backend_C_r_S_unchanged(c, sMgr)
|
||||
|
@ -1552,7 +1555,7 @@ Current Serial: %[2]d
|
|||
`
|
||||
|
||||
const outputBackendMigrateChange = `
|
||||
Terraform detected a backend configuration change from %q to %q.
|
||||
Terraform detected that the backend type changed from %q to %q.
|
||||
`
|
||||
|
||||
const outputBackendMigrateLegacy = `
|
||||
|
@ -1576,9 +1579,7 @@ const outputBackendReconfigure = `
|
|||
[reset][bold]Backend configuration changed![reset]
|
||||
|
||||
Terraform has detected that the configuration specified for the backend
|
||||
has changed. Terraform will now reconfigure for this backend. If you didn't
|
||||
intend to reconfigure your backend please undo any changes to the "backend"
|
||||
section in your Terraform configuration.
|
||||
has changed. Terraform will now check for existing state in the backends.
|
||||
`
|
||||
|
||||
const outputBackendSavedWithLegacy = `
|
||||
|
|
|
@ -338,9 +338,7 @@ func (m *Meta) backendMigrateState_s_s(opts *backendMigrateOpts) error {
|
|||
func (m *Meta) backendMigrateEmptyConfirm(one, two state.State, opts *backendMigrateOpts) (bool, error) {
|
||||
inputOpts := &terraform.InputOpts{
|
||||
Id: "backend-migrate-copy-to-empty",
|
||||
Query: fmt.Sprintf(
|
||||
"Do you want to copy state from %q to %q?",
|
||||
opts.OneType, opts.TwoType),
|
||||
Query: "Do you want to copy existing state to the new backend?",
|
||||
Description: fmt.Sprintf(
|
||||
strings.TrimSpace(inputBackendMigrateEmpty),
|
||||
opts.OneType, opts.TwoType),
|
||||
|
@ -386,9 +384,7 @@ func (m *Meta) backendMigrateNonEmptyConfirm(
|
|||
// Ask for confirmation
|
||||
inputOpts := &terraform.InputOpts{
|
||||
Id: "backend-migrate-to-backend",
|
||||
Query: fmt.Sprintf(
|
||||
"Do you want to copy state from %q to %q?",
|
||||
opts.OneType, opts.TwoType),
|
||||
Query: "Do you want to copy existing state to the new backend?",
|
||||
Description: fmt.Sprintf(
|
||||
strings.TrimSpace(inputBackendMigrateNonEmpty),
|
||||
opts.OneType, opts.TwoType, onePath, twoPath),
|
||||
|
@ -410,7 +406,8 @@ type backendMigrateOpts struct {
|
|||
}
|
||||
|
||||
const errMigrateLoadStates = `
|
||||
Error inspecting state in %q: %s
|
||||
Error inspecting states in the %q backend:
|
||||
%s
|
||||
|
||||
Prior to changing backends, Terraform inspects the source and destination
|
||||
states to determine what kind of migration steps need to be taken, if any.
|
||||
|
@ -419,9 +416,10 @@ destination remain unmodified. Please resolve the above error and try again.
|
|||
`
|
||||
|
||||
const errMigrateSingleLoadDefault = `
|
||||
Error loading state from %q: %s
|
||||
Error loading state:
|
||||
%[2]s
|
||||
|
||||
Terraform failed to load the default state from %[1]q.
|
||||
Terraform failed to load the default state from the %[1]q backend.
|
||||
State migration cannot occur unless the state can be loaded. Backend
|
||||
modification and state migration has been aborted. The state in both the
|
||||
source and the destination remain unmodified. Please resolve the
|
||||
|
@ -429,8 +427,8 @@ above error and try again.
|
|||
`
|
||||
|
||||
const errMigrateMulti = `
|
||||
Error migrating the workspace %q from %q to %q:
|
||||
|
||||
Error migrating the workspace %q from the previous %q backend to the newly
|
||||
configured %q backend:
|
||||
%s
|
||||
|
||||
Terraform copies workspaces in alphabetical order. Any workspaces
|
||||
|
@ -443,41 +441,45 @@ This will attempt to copy (with permission) all workspaces again.
|
|||
`
|
||||
|
||||
const errBackendStateCopy = `
|
||||
Error copying state from %q to %q: %s
|
||||
Error copying state from the previous %q backend to the newly configured %q backend:
|
||||
%s
|
||||
|
||||
The state in %[1]q remains intact and unmodified. Please resolve the
|
||||
error above and try again.
|
||||
The state in the previous backend remains intact and unmodified. Please resolve
|
||||
the error above and try again.
|
||||
`
|
||||
|
||||
const inputBackendMigrateEmpty = `
|
||||
Pre-existing state was found in %q while migrating to %q. No existing
|
||||
state was found in %[2]q. Do you want to copy the state from %[1]q to
|
||||
%[2]q? Enter "yes" to copy and "no" to start with an empty state.
|
||||
Pre-existing state was found while migrating the previous %q backend to the
|
||||
newly configured %q backend. No existing state was found in the newly
|
||||
configured %[2]q backend. Do you want to copy this state to the new %[2]q
|
||||
backend? Enter "yes" to copy and "no" to start with an empty state.
|
||||
`
|
||||
|
||||
const inputBackendMigrateNonEmpty = `
|
||||
Pre-existing state was found in %q while migrating to %q. An existing
|
||||
non-empty state exists in %[2]q. The two states have been saved to temporary
|
||||
files that will be removed after responding to this query.
|
||||
Pre-existing state was found while migrating the previous %q backend to the
|
||||
newly configured %q backend. An existing non-empty state already exists in
|
||||
the new backend. The two states have been saved to temporary files that will be
|
||||
removed after responding to this query.
|
||||
|
||||
One (%[1]q): %[3]s
|
||||
Two (%[2]q): %[4]s
|
||||
Previous (type %[1]q): %[3]s
|
||||
New (type %[2]q): %[4]s
|
||||
|
||||
Do you want to copy the state from %[1]q to %[2]q? Enter "yes" to copy
|
||||
and "no" to start with the existing state in %[2]q.
|
||||
Do you want to overwrite the state in the new backend with the previous state?
|
||||
Enter "yes" to copy and "no" to start with the existing state in the newly
|
||||
configured %[2]q backend.
|
||||
`
|
||||
|
||||
const inputBackendMigrateMultiToSingle = `
|
||||
The existing backend %[1]q supports workspaces and you currently are
|
||||
using more than one. The target backend %[2]q doesn't support workspaces.
|
||||
If you continue, Terraform will offer to copy your current workspace
|
||||
%[3]q to the default workspace in the target. Your existing workspaces
|
||||
in the source backend won't be modified. If you want to switch workspaces,
|
||||
back them up, or cancel altogether, answer "no" and Terraform will abort.
|
||||
The existing %[1]q backend supports workspaces and you currently are
|
||||
using more than one. The newly configured %[2]q backend doesn't support
|
||||
workspaces. If you continue, Terraform will copy your current workspace %[3]q
|
||||
to the default workspace in the target backend. Your existing workspaces in the
|
||||
source backend won't be modified. If you want to switch workspaces, back them
|
||||
up, or cancel altogether, answer "no" and Terraform will abort.
|
||||
`
|
||||
|
||||
const inputBackendMigrateMultiToMulti = `
|
||||
Both the existing backend %[1]q and the target backend %[2]q support
|
||||
Both the existing %[1]q backend and the newly configured %[2]q backend support
|
||||
workspaces. When migrating between backends, Terraform will copy all
|
||||
workspaces (with the same names). THIS WILL OVERWRITE any conflicting
|
||||
states in the destination.
|
||||
|
|
Loading…
Reference in New Issue