mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
don't check all ancestors for data depends_on
Only depends_on ancestors for transitive dependencies when we're not pointed directly at a resource. We can't be much more precise here, since in order to maintain our guarantee that data sources will wait for explicit dependencies, if those dependencies happen to be a module, output, or variable, we have to find some upstream managed resource in order to check for a planned change.
This commit is contained in:
parent
0062e7112a
commit
016463ea9c
@ -353,11 +353,19 @@ func (m ReferenceMap) dependsOn(g *Graph, depender graphNodeDependsOn) ([]dag.Ve
|
|||||||
}
|
}
|
||||||
res = append(res, rv)
|
res = append(res, rv)
|
||||||
|
|
||||||
// and check any ancestors for transitive dependencies
|
// Check any ancestors for transitive dependencies when we're
|
||||||
ans, _ := g.Ancestors(rv)
|
// not pointed directly at a resource. We can't be much more
|
||||||
for _, v := range ans {
|
// precise here, since in order to maintain our guarantee that data
|
||||||
if isDependableResource(v) {
|
// sources will wait for explicit dependencies, if those dependencies
|
||||||
res = append(res, v)
|
// happen to be a module, output, or variable, we have to find some
|
||||||
|
// upstream managed resource in order to check for a planned
|
||||||
|
// change.
|
||||||
|
if _, ok := rv.(GraphNodeConfigResource); !ok {
|
||||||
|
ans, _ := g.Ancestors(rv)
|
||||||
|
for _, v := range ans {
|
||||||
|
if isDependableResource(v) {
|
||||||
|
res = append(res, v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user