diff --git a/command/init.go b/command/init.go index 6cf0c42ed..ec5b505bd 100644 --- a/command/init.go +++ b/command/init.go @@ -933,6 +933,7 @@ func (c *InitCommand) AutocompleteFlags() complete.Flags { "-no-color": complete.PredictNothing, "-plugin-dir": complete.PredictDirs(""), "-reconfigure": complete.PredictNothing, + "-migrate-state": complete.PredictNothing, "-upgrade": completePredictBoolean, } } @@ -987,6 +988,9 @@ Options: -reconfigure Reconfigure the backend, ignoring any saved configuration. + -migrate-state Reconfigure the backend, and attempt to migrate any + existing state. + -upgrade=false If installing modules (-get) or plugins, ignore previously-downloaded objects and install the latest version allowed within configured constraints. diff --git a/website/docs/cli/commands/init.html.md b/website/docs/cli/commands/init.html.md index 04278636e..7a380a3c7 100644 --- a/website/docs/cli/commands/init.html.md +++ b/website/docs/cli/commands/init.html.md @@ -79,11 +79,17 @@ During init, the root configuration directory is consulted for is initialized using the given configuration settings. Re-running init with an already-initialized backend will update the working -directory to use the new backend settings. Depending on what changed, this -may result in interactive prompts to confirm migration of workspace states. -The `-force-copy` option suppresses these prompts and answers "yes" to the -migration questions. The `-reconfigure` option disregards any existing -configuration, preventing migration of any existing state. +directory to use the new backend settings. Either `-reconfigure` or +`-migrate-state` must be supplied to update the backend configuration. + +The `-migrate-state` option will attempt to copy existing state to the new +backend, and depending on what changed, may result in interactive prompts to +confirm migration of workspace states. The `-force-copy` option suppresses +these prompts and answers "yes" to the migration questions. This implies +`-migrate-state`. + +The `-reconfigure` option disregards any existing configuration, preventing +migration of any existing state. To skip backend configuration, use `-backend=false`. Note that some other init steps require an initialized backend, so it is recommended to use this flag only