cli: Add -ignore-remote-version flag for init
When performing state migration to a remote backend target, Terraform may fail due to mismatched remote and local Terraform versions. Here we add the `-ignore-remote-version` flag to allow users to ignore this version check when necessary.
This commit is contained in:
parent
6692336541
commit
3f0c6a2217
|
@ -49,6 +49,7 @@ func (c *InitCommand) Run(args []string) int {
|
|||
cmdFlags.BoolVar(&flagUpgrade, "upgrade", false, "")
|
||||
cmdFlags.Var(&flagPluginPath, "plugin-dir", "plugin directory")
|
||||
cmdFlags.StringVar(&flagLockfile, "lockfile", "", "Set a dependency lockfile mode")
|
||||
cmdFlags.BoolVar(&c.Meta.ignoreRemoteVersion, "ignore-remote-version", false, "continue even if remote and local Terraform versions are incompatible")
|
||||
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
|
||||
if err := cmdFlags.Parse(args); err != nil {
|
||||
return 1
|
||||
|
@ -962,46 +963,49 @@ Usage: terraform [global options] init [options]
|
|||
|
||||
Options:
|
||||
|
||||
-backend=true Configure the backend for this configuration.
|
||||
-backend=true Configure the backend for this configuration.
|
||||
|
||||
-backend-config=path This can be either a path to an HCL file with key/value
|
||||
assignments (same format as terraform.tfvars) or a
|
||||
'key=value' format. This is merged with what is in the
|
||||
configuration file. This can be specified multiple
|
||||
times. The backend type must be in the configuration
|
||||
itself.
|
||||
-backend-config=path This can be either a path to an HCL file with key/value
|
||||
assignments (same format as terraform.tfvars) or a
|
||||
'key=value' format. This is merged with what is in the
|
||||
configuration file. This can be specified multiple
|
||||
times. The backend type must be in the configuration
|
||||
itself.
|
||||
|
||||
-force-copy Suppress prompts about copying state data. This is
|
||||
equivalent to providing a "yes" to all confirmation
|
||||
prompts.
|
||||
-force-copy Suppress prompts about copying state data. This is
|
||||
equivalent to providing a "yes" to all confirmation
|
||||
prompts.
|
||||
|
||||
-from-module=SOURCE Copy the contents of the given module into the target
|
||||
directory before initialization.
|
||||
-from-module=SOURCE Copy the contents of the given module into the target
|
||||
directory before initialization.
|
||||
|
||||
-get=true Download any modules for this configuration.
|
||||
-get=true Download any modules for this configuration.
|
||||
|
||||
-input=true Ask for input if necessary. If false, will error if
|
||||
input was required.
|
||||
-input=true Ask for input if necessary. If false, will error if
|
||||
input was required.
|
||||
|
||||
-no-color If specified, output won't contain any color.
|
||||
-no-color If specified, output won't contain any color.
|
||||
|
||||
-plugin-dir Directory containing plugin binaries. This overrides all
|
||||
default search paths for plugins, and prevents the
|
||||
automatic installation of plugins. This flag can be used
|
||||
multiple times.
|
||||
-plugin-dir Directory containing plugin binaries. This overrides all
|
||||
default search paths for plugins, and prevents the
|
||||
automatic installation of plugins. This flag can be used
|
||||
multiple times.
|
||||
|
||||
-reconfigure Reconfigure the backend, ignoring any saved
|
||||
configuration.
|
||||
-reconfigure Reconfigure the backend, ignoring any saved
|
||||
configuration.
|
||||
|
||||
-migrate-state Reconfigure the backend, and attempt to migrate any
|
||||
existing state.
|
||||
-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.
|
||||
-upgrade=false If installing modules (-get) or plugins, ignore
|
||||
previously-downloaded objects and install the
|
||||
latest version allowed within configured constraints.
|
||||
|
||||
-lockfile=MODE Set a dependency lockfile mode.
|
||||
Currently only "readonly" is valid.
|
||||
-lockfile=MODE Set a dependency lockfile mode.
|
||||
Currently only "readonly" is valid.
|
||||
|
||||
-ignore-remote-version A rare option used for the remote backend only. See
|
||||
the remote backend documentation for more information.
|
||||
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
|
|
Loading…
Reference in New Issue