prevent -migrate-state with -reconfigure

This commit is contained in:
James Bardin 2021-05-17 14:28:34 -04:00
parent 1b48636b42
commit b11578da45
2 changed files with 5 additions and 5 deletions

View File

@ -54,6 +54,11 @@ func (c *InitCommand) Run(args []string) int {
return 1 return 1
} }
if c.migrateState && c.reconfigure {
c.Ui.Error("The -migrate-state and -reconfigure options are mutually-exclusive")
return 1
}
// Copying the state only happens during backend migration, so setting // Copying the state only happens during backend migration, so setting
// -force-copy implies -migrate-state // -force-copy implies -migrate-state
if c.forceInitCopy { if c.forceInitCopy {

View File

@ -1114,11 +1114,6 @@ func (m *Meta) backendInitFromConfig(c *configs.Backend) (backend.Backend, cty.V
return b, configVal, diags return b, configVal, diags
} }
func (m *Meta) backendInitRequired(reason string) {
m.Ui.Output(m.Colorize().Color(fmt.Sprintf(
"[reset]"+strings.TrimSpace(errBackendInit)+"\n", reason)))
}
// Helper method to ignore remote backend version conflicts. Only call this // Helper method to ignore remote backend version conflicts. Only call this
// for commands which cannot accidentally upgrade remote state files. // for commands which cannot accidentally upgrade remote state files.
func (m *Meta) ignoreRemoteBackendVersionConflict(b backend.Backend) { func (m *Meta) ignoreRemoteBackendVersionConflict(b backend.Backend) {