command: legacy remote state should load from backendinit

This commit is contained in:
Mitchell Hashimoto 2017-02-28 19:29:19 -08:00
parent 6ea0dc0964
commit 2c19aa69d9
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 21 additions and 2 deletions

View File

@ -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
`