@@ -23,7 +23,6 @@ import (
2323 "github.com/hashicorp/terraform/terraform"
2424 "github.com/mitchellh/mapstructure"
2525
26- backendlegacy "github.com/hashicorp/terraform/backend/legacy"
2726 backendlocal "github.com/hashicorp/terraform/backend/local"
2827)
2928
@@ -1325,8 +1324,12 @@ func (m *Meta) backendInitFromLegacy(s *terraform.RemoteState) (backend.Backend,
13251324 }
13261325 config := terraform .NewResourceConfig (rawC )
13271326
1328- // Initialize the legacy remote backend
1329- b := & backendlegacy.Backend {Type : s .Type }
1327+ // Get the backend
1328+ f := backendinit .Backend (s .Type )
1329+ if f == nil {
1330+ return nil , fmt .Errorf (strings .TrimSpace (errBackendLegacyUnknown ), s .Type )
1331+ }
1332+ b := f ()
13301333
13311334 // Configure
13321335 if err := b .Configure (config ); err != nil {
@@ -1381,7 +1384,7 @@ If fixing these errors requires changing your remote state configuration,
13811384you must switch your configuration to the new remote backend configuration.
13821385You can learn more about remote backends at the URL below:
13831386
1384- TODO: URL
1387+ https://www.terraform.io/docs/backends/index.html
13851388
13861389The error(s) configuring the legacy remote state:
13871390
@@ -1391,7 +1394,7 @@ The error(s) configuring the legacy remote state:
13911394const errBackendLegacyUnknown = `
13921395The legacy remote state type %q could not be found.
13931396
1394- Terraform 0.9.0 shipped with backwards compatible for all built-in
1397+ Terraform 0.9.0 shipped with backwards compatibility for all built-in
13951398legacy remote state types. This error may mean that you were using a
13961399custom Terraform build that perhaps supported a different type of
13971400remote state.
0 commit comments