From b11578da45b362eb23f2551847dac8e5b54e2605 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Mon, 17 May 2021 14:28:34 -0400 Subject: [PATCH] prevent -migrate-state with -reconfigure --- command/init.go | 5 +++++ command/meta_backend.go | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/command/init.go b/command/init.go index ec5b505bd..0f0b41d81 100644 --- a/command/init.go +++ b/command/init.go @@ -54,6 +54,11 @@ func (c *InitCommand) Run(args []string) int { 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 // -force-copy implies -migrate-state if c.forceInitCopy { diff --git a/command/meta_backend.go b/command/meta_backend.go index cce4c3568..2c378ae67 100644 --- a/command/meta_backend.go +++ b/command/meta_backend.go @@ -1114,11 +1114,6 @@ func (m *Meta) backendInitFromConfig(c *configs.Backend) (backend.Backend, cty.V 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 // for commands which cannot accidentally upgrade remote state files. func (m *Meta) ignoreRemoteBackendVersionConflict(b backend.Backend) {