Merge pull request #29438 from hashicorp/alisdair/init-force-copy-multiple-workspaces
command: Suppress prompt for init -force-copy
This commit is contained in:
commit
40dd4292b8
|
@ -146,19 +146,23 @@ func (m *Meta) backendMigrateState(opts *backendMigrateOpts) error {
|
||||||
func (m *Meta) backendMigrateState_S_S(opts *backendMigrateOpts) error {
|
func (m *Meta) backendMigrateState_S_S(opts *backendMigrateOpts) error {
|
||||||
log.Print("[TRACE] backendMigrateState: migrating all named workspaces")
|
log.Print("[TRACE] backendMigrateState: migrating all named workspaces")
|
||||||
|
|
||||||
// Ask the user if they want to migrate their existing remote state
|
migrate := opts.force
|
||||||
migrate, err := m.confirm(&terraform.InputOpts{
|
if !migrate {
|
||||||
Id: "backend-migrate-multistate-to-multistate",
|
var err error
|
||||||
Query: fmt.Sprintf(
|
// Ask the user if they want to migrate their existing remote state
|
||||||
"Do you want to migrate all workspaces to %q?",
|
migrate, err = m.confirm(&terraform.InputOpts{
|
||||||
opts.TwoType),
|
Id: "backend-migrate-multistate-to-multistate",
|
||||||
Description: fmt.Sprintf(
|
Query: fmt.Sprintf(
|
||||||
strings.TrimSpace(inputBackendMigrateMultiToMulti),
|
"Do you want to migrate all workspaces to %q?",
|
||||||
opts.OneType, opts.TwoType),
|
opts.TwoType),
|
||||||
})
|
Description: fmt.Sprintf(
|
||||||
if err != nil {
|
strings.TrimSpace(inputBackendMigrateMultiToMulti),
|
||||||
return fmt.Errorf(
|
opts.OneType, opts.TwoType),
|
||||||
"Error asking for state migration action: %s", err)
|
})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf(
|
||||||
|
"Error asking for state migration action: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if !migrate {
|
if !migrate {
|
||||||
return fmt.Errorf("Migration aborted by user.")
|
return fmt.Errorf("Migration aborted by user.")
|
||||||
|
|
Loading…
Reference in New Issue