From eaf3d608ed01a4ccfcb737a5791b590d5374ed53 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 12 Apr 2016 15:21:10 -0700 Subject: [PATCH] terraform: test moving a module to be nested --- terraform/state_add_test.go | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/terraform/state_add_test.go b/terraform/state_add_test.go index f1d5e34581..6d2f326965 100644 --- a/terraform/state_add_test.go +++ b/terraform/state_add_test.go @@ -59,6 +59,54 @@ func TestStateAdd(t *testing.T) { }, }, + "ModuleState => Nested Module Addr (new)": { + false, + "", + "module.foo.module.bar", + &ModuleState{ + Path: rootModulePath, + Resources: map[string]*ResourceState{ + "test_instance.foo": &ResourceState{ + Type: "test_instance", + Primary: &InstanceState{ + ID: "foo", + }, + }, + + "test_instance.bar": &ResourceState{ + Type: "test_instance", + Primary: &InstanceState{ + ID: "foo", + }, + }, + }, + }, + + &State{}, + &State{ + Modules: []*ModuleState{ + &ModuleState{ + Path: []string{"root", "foo", "bar"}, + Resources: map[string]*ResourceState{ + "test_instance.foo": &ResourceState{ + Type: "test_instance", + Primary: &InstanceState{ + ID: "foo", + }, + }, + + "test_instance.bar": &ResourceState{ + Type: "test_instance", + Primary: &InstanceState{ + ID: "foo", + }, + }, + }, + }, + }, + }, + }, + "ModuleState w/ outputs and deps => Module Addr (new)": { false, "",