{"record":{"id":"45c02ae092a2472a","repo":"hashicorp/terraform","slug":"can-t-ask-approval-for-state-migration-when-intera","errorCode":null,"errorMessage":"Can't ask approval for state migration when interactive input is disabled.\n\nPlease remove the \"-input=false\" option and try again.","messagePattern":"Can't ask approval for state migration when interactive input is disabled\\.\n\nPlease remove the \"-input=false\" option and try again\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/meta_backend_migrate.go","lineNumber":924,"sourceCode":"\t\t\tDescription: fmt.Sprintf(strings.TrimSpace(tfcInputBackendMigrateRemoteMultiToCloud), appName),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error asking for state migration action: %s\", err)\n\t\t}\n\t}\n\n\tif !migrate {\n\t\treturn fmt.Errorf(\"Migration aborted by user.\")\n\t}\n\n\treturn nil\n}\n\n// Multi-state to single state.\nfunc (m *Meta) promptMultiToSingleCloudMigration(opts *backendMigrateOpts) error {\n\tif !m.input {\n\t\tlog.Print(\"[TRACE] backendMigrateState: can't prompt for input, so aborting migration\")\n\t\treturn errors.New(strings.TrimSpace(errInteractiveInputDisabled))\n\t}\n\tmigrate := opts.force\n\tif !migrate {\n\t\tvar err error\n\t\tappName := \"HCP Terraform\"\n\t\tif cloudBackend, ok := opts.Destination.(*cloud.Cloud); ok {\n\t\t\tappName = cloudBackend.AppName()\n\t\t}\n\t\tsrcWord := backendHumanName(opts.Source)\n\t\t// Ask the user if they want to migrate their existing remote state\n\t\tmigrate, err = m.confirm(&terraform.InputOpts{\n\t\t\tId:    \"backend-migrate-multistate-to-single\",\n\t\t\tQuery: \"Do you want to copy only your current workspace?\",\n\t\t\tDescription: fmt.Sprintf(\n\t\t\t\tstrings.TrimSpace(tfcInputBackendMigrateMultiToSingle),\n\t\t\t\topts.SourceType, srcWord, opts.destinationWorkspace, appName),\n\t\t})\n\t\tif err != nil {","sourceCodeStart":906,"sourceCodeEnd":942,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/meta_backend_migrate.go#L906-L942","documentation":"`promptMultiToSingleCloudMigration` returns this when collapsing a multi-state backend into a single cloud workspace needs a confirmation but input is disabled (`m.input == false`) and `-force` is not set. This path is lossy by nature (multiple workspaces -> one), so Terraform insists on explicit consent.","triggerScenarios":"`terraform init` migrates from a multi-state backend (e.g. `backend \"remote\"` with multiple named workspaces) into a single cloud workspace, `m.input == false`, `opts.force == false`.","commonSituations":"Consolidating workspaces during a backend refactor in CI; the multi->single reduction can drop states and Terraform will not do it silently.","solutions":["Reconsider the migration: multi->single is destructive; instead target a `cloud` block that preserves separate workspaces.","Run interactively (drop `-input=false`) and confirm you accept the consolidation.","If intentional, pass `-migrate-state -force` and verify the surviving state afterward."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before multi->single cloud migration:\nif !m.input && !opts.force {\n    return errors.New(strings.TrimSpace(errInteractiveInputDisabled))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid multi->single migrations; they are destructive — restructure the cloud block to keep multiple workspaces.","If unavoidable, confirm explicitly and back up state first.","Never run this path silently under `-input=false`."],"tags":["backend-migration","cloud","multi-state","input-disabled","interactive","state","terraform-cli"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}