diff --git a/terraform/context_test.go b/terraform/context_test.go index a6fa3b7ce..bb03dce18 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -3535,7 +3535,6 @@ func TestContextApply_errorDestroy_createBeforeDestroy(t *testing.T) { } */ -/* func TestContext2Apply_provisionerResourceRef(t *testing.T) { m := testModule(t, "apply-provisioner-resource-ref") p := testProvider("aws") diff --git a/terraform/graph_builder.go b/terraform/graph_builder.go index 53dfaeeb2..dafda63d5 100644 --- a/terraform/graph_builder.go +++ b/terraform/graph_builder.go @@ -1,6 +1,8 @@ package terraform import ( + "log" + "github.com/hashicorp/terraform/config/module" ) @@ -29,6 +31,7 @@ func (b *BasicGraphBuilder) Build(path []string) (*Graph, error) { // Validate the graph structure if err := g.Validate(); err != nil { + log.Printf("[ERROR] Graph validation failed. Graph: %s", g.String()) return nil, err } diff --git a/terraform/graph_config_node.go b/terraform/graph_config_node.go index bfabfe78f..4c539f8b9 100644 --- a/terraform/graph_config_node.go +++ b/terraform/graph_config_node.go @@ -189,6 +189,7 @@ func (n *GraphNodeConfigResource) DependentOn() []string { len(n.Resource.RawConfig.Variables)+ len(n.Resource.DependsOn))*2) copy(result, n.Resource.DependsOn) + for _, v := range n.Resource.RawCount.Variables { if vn := varNameForVar(v); vn != "" { result = append(result, vn) @@ -201,12 +202,12 @@ func (n *GraphNodeConfigResource) DependentOn() []string { } for _, p := range n.Resource.Provisioners { for _, v := range p.ConnInfo.Variables { - if vn := varNameForVar(v); vn != "" { + if vn := varNameForVar(v); vn != "" && vn != n.Resource.Id() { result = append(result, vn) } } for _, v := range p.RawConfig.Variables { - if vn := varNameForVar(v); vn != "" { + if vn := varNameForVar(v); vn != "" && vn != n.Resource.Id() { result = append(result, vn) } }