mirror of https://github.com/hashicorp/terraform
Merge pull request #12937 from hashicorp/b-state-v1-panic
terraform: convert empty path to root path in V1 statepull/12940/head^2
commit
7729949ef4
@ -0,0 +1,22 @@
|
||||
package terraform
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReadStateV1ToV2_noPath(t *testing.T) {
|
||||
f, err := os.Open(filepath.Join(fixtureDir, "state-upgrade", "v1-to-v2-empty-path.tfstate"))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
s, err := ReadState(f)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
checkStateString(t, s, "<no state>")
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
{
|
||||
"version": 1,
|
||||
"modules": [{
|
||||
"resources": {
|
||||
"aws_instance.foo1": {"primary":{}},
|
||||
"cloudstack_instance.foo1": {"primary":{}},
|
||||
"cloudstack_instance.foo2": {"primary":{}},
|
||||
"digitalocean_droplet.foo1": {"primary":{}},
|
||||
"digitalocean_droplet.foo2": {"primary":{}},
|
||||
"digitalocean_droplet.foo3": {"primary":{}},
|
||||
"docker_container.foo1": {"primary":{}},
|
||||
"docker_container.foo2": {"primary":{}},
|
||||
"docker_container.foo3": {"primary":{}},
|
||||
"docker_container.foo4": {"primary":{}},
|
||||
"google_compute_instance.foo1": {"primary":{}},
|
||||
"google_compute_instance.foo2": {"primary":{}},
|
||||
"google_compute_instance.foo3": {"primary":{}},
|
||||
"google_compute_instance.foo4": {"primary":{}},
|
||||
"google_compute_instance.foo5": {"primary":{}},
|
||||
"heroku_app.foo1": {"primary":{}},
|
||||
"heroku_app.foo2": {"primary":{}},
|
||||
"heroku_app.foo3": {"primary":{}},
|
||||
"heroku_app.foo4": {"primary":{}},
|
||||
"heroku_app.foo5": {"primary":{}},
|
||||
"heroku_app.foo6": {"primary":{}},
|
||||
"openstack_compute_instance_v2.foo1": {"primary":{}},
|
||||
"openstack_compute_instance_v2.foo2": {"primary":{}},
|
||||
"openstack_compute_instance_v2.foo3": {"primary":{}},
|
||||
"openstack_compute_instance_v2.foo4": {"primary":{}},
|
||||
"openstack_compute_instance_v2.foo5": {"primary":{}},
|
||||
"openstack_compute_instance_v2.foo6": {"primary":{}},
|
||||
"openstack_compute_instance_v2.foo7": {"primary":{}},
|
||||
"bar": {"primary":{}},
|
||||
"baz": {"primary":{}},
|
||||
"zip": {"primary":{}}
|
||||
}
|
||||
}]
|
||||
}
|
||||
Loading…
Reference in new issue