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:
James Bardin 2021-09-28 17:57:10 -04:00
parent 0062e7112a
commit 016463ea9c

View File

@ -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)
}
} }
} }
} }