diff --git a/terraform/graph_test.go b/terraform/graph_test.go index d7b464ffe..4f87e245b 100644 --- a/terraform/graph_test.go +++ b/terraform/graph_test.go @@ -754,8 +754,27 @@ func TestGraphAddDiff_module_depends(t *testing.T) { }, }, } + state := &State{ + Modules: []*ModuleState{ + &ModuleState{ + Path: []string{"root", "orphan"}, + Resources: map[string]*ResourceState{ + "aws_instance.dead": &ResourceState{ + Type: "aws_instance", + Primary: &InstanceState{ + ID: "dead", + }, + }, + }, + Dependencies: []string{ + "aws_instance.foo", + "module.child", + }, + }, + }, + } - g, err := Graph(&GraphOpts{Module: m, Diff: diff}) + g, err := Graph(&GraphOpts{Module: m, Diff: diff, State: state}) if err != nil { t.Fatalf("err: %s", err) } @@ -1316,10 +1335,14 @@ aws_instance.foo aws_instance.foo -> aws_instance.foo (destroy) aws_instance.foo (destroy) aws_instance.foo (destroy) -> module.child + aws_instance.foo (destroy) -> module.orphan module.child + module.child -> module.orphan +module.orphan root root -> aws_instance.foo root -> module.child + root -> module.orphan ` const testTerraformGraphModulesStr = `