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