Skip to content

Commit

Permalink
command: legacy remote state should load from backendinit
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Mar 1, 2017
1 parent 6ea0dc0 commit 2c19aa6
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions command/meta_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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

This comment has been minimized.

Copy link
@jbardin

jbardin Mar 17, 2017

Member

wording?

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
Expand Down Expand Up @@ -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
`

0 comments on commit 2c19aa6

Please sign in to comment.