Merge pull request #12818 from hashicorp/b-legacy
command: use backendinit instead of initializing legacy directly
This commit is contained in:
commit
23505cc2a8
|
@ -23,7 +23,6 @@ import (
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
|
|
||||||
backendlegacy "github.com/hashicorp/terraform/backend/legacy"
|
|
||||||
backendlocal "github.com/hashicorp/terraform/backend/local"
|
backendlocal "github.com/hashicorp/terraform/backend/local"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1325,8 +1324,12 @@ func (m *Meta) backendInitFromLegacy(s *terraform.RemoteState) (backend.Backend,
|
||||||
}
|
}
|
||||||
config := terraform.NewResourceConfig(rawC)
|
config := terraform.NewResourceConfig(rawC)
|
||||||
|
|
||||||
// Initialize the legacy remote backend
|
// Get the backend
|
||||||
b := &backendlegacy.Backend{Type: s.Type}
|
f := backendinit.Backend(s.Type)
|
||||||
|
if f == nil {
|
||||||
|
return nil, fmt.Errorf(strings.TrimSpace(errBackendLegacyUnknown), s.Type)
|
||||||
|
}
|
||||||
|
b := f()
|
||||||
|
|
||||||
// Configure
|
// Configure
|
||||||
if err := b.Configure(config); err != nil {
|
if err := b.Configure(config); err != nil {
|
||||||
|
@ -1381,7 +1384,7 @@ If fixing these errors requires changing your remote state configuration,
|
||||||
you must switch your configuration to the new remote backend configuration.
|
you must switch your configuration to the new remote backend configuration.
|
||||||
You can learn more about remote backends at the URL below:
|
You can learn more about remote backends at the URL below:
|
||||||
|
|
||||||
TODO: URL
|
https://www.terraform.io/docs/backends/index.html
|
||||||
|
|
||||||
The error(s) configuring the legacy remote state:
|
The error(s) configuring the legacy remote state:
|
||||||
|
|
||||||
|
@ -1391,7 +1394,7 @@ The error(s) configuring the legacy remote state:
|
||||||
const errBackendLegacyUnknown = `
|
const errBackendLegacyUnknown = `
|
||||||
The legacy remote state type %q could not be found.
|
The legacy remote state type %q could not be found.
|
||||||
|
|
||||||
Terraform 0.9.0 shipped with backwards compatible for all built-in
|
Terraform 0.9.0 shipped with backwards compatibility for all built-in
|
||||||
legacy remote state types. This error may mean that you were using a
|
legacy remote state types. This error may mean that you were using a
|
||||||
custom Terraform build that perhaps supported a different type of
|
custom Terraform build that perhaps supported a different type of
|
||||||
remote state.
|
remote state.
|
||||||
|
|
Loading…
Reference in New Issue