From 2c19aa69d9f4d4da43b1cedd17c5484c121fcc18 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 28 Feb 2017 19:29:19 -0800 Subject: [PATCH] command: legacy remote state should load from backendinit --- command/meta_backend.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/command/meta_backend.go b/command/meta_backend.go index 86d7aaf7b..55ceba2dc 100644 --- a/command/meta_backend.go +++ b/command/meta_backend.go @@ -737,8 +737,12 @@ func (m *Meta) backend_c_R_s( } config := terraform.NewResourceConfig(rawC) - // Initialize the legacy remote backend - b := &backendlegacy.Backend{Type: s.Remote.Type} + // Get the backend + f := backendinit.Backend(s.Remote.Type) + if f == nil { + return nil, fmt.Errorf(strings.TrimSpace(errBackendLegacyUnknown), s.Remote.Type) + } + b := f() // Configure if err := b.Configure(config); err != nil { @@ -1432,6 +1436,17 @@ The error(s) configuring the legacy remote state: %s ` +const errBackendLegacyUnknown = ` +The legacy remote state type %q could not be found. + +Terraform 0.9.0 shipped with backwards compatible for all built-in +legacy remote state types. This error may mean that you were using a +custom Terraform build that perhaps supported a different type of +remote state. + +Please check with the creator of the remote state above and try again. +` + const errBackendLocalRead = ` Error reading local state: %s @@ -1711,4 +1726,8 @@ Remote state changed significantly in Terraform 0.9. Please update your remote state configuration to use the new 'backend' settings. For now, Terraform will continue to use your existing settings. Legacy remote state support will be removed in Terraform 0.11. + +You can find a guide for upgrading here: + +https://www.terraform.io/docs/backends/legacy-0-8.html `