Skip to content

Commit

Permalink
Merge pull request #36210 from hashicorp/jbardin/inter-provider-perf
Browse files Browse the repository at this point in the history
core: simplify cycle check for inter-provider deps
  • Loading branch information
jbardin authored Dec 13, 2024
2 parents d2c0a0e + dde9ebd commit 422a79a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/terraform/transform_destroy_edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (t *DestroyEdgeTransformer) tryInterProviderDestroyEdge(g *Graph, from, to
// Check for cycles, and back out the edge if there are any.
// The cycles we are looking for only appears between providers, so don't
// waste time checking for cycles if both nodes use the same provider.
if fromProvider != toProvider && len(g.Cycles()) > 0 {
if fromProvider != toProvider && g.Ancestors(to).Include(from) {
log.Printf("[DEBUG] DestroyEdgeTransformer: skipping inter-provider edge %s->%s which creates a cycle",
dag.VertexName(from), dag.VertexName(to))
g.RemoveEdge(e)
Expand Down

0 comments on commit 422a79a

Please sign in to comment.