mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-15 10:03:44 -06:00
terraform: resource provisioner self references are not put in the graph
This commit is contained in:
parent
edfb11ff1d
commit
c70cc682ea
@ -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")
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user