Merge pull request #32236 from hashicorp/jbardin/1.3-destroy-perf

check walkDestroy to help DestroyEdgeTransformer
This commit is contained in:
James Bardin 2022-11-22 09:45:32 -05:00 committed by GitHub
commit 60f82eea40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -144,7 +144,8 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer {
// Destruction ordering
&DestroyEdgeTransformer{
Changes: b.Changes,
Changes: b.Changes,
Operation: b.Operation,
},
&CBDEdgeTransformer{
Config: b.Config,

View File

@ -46,6 +46,11 @@ type DestroyEdgeTransformer struct {
// DiffTransformer which was intended to be the only transformer operating
// from the change set.
Changes *plans.Changes
// FIXME: Operation will not be needed here one we can better track
// inter-provider dependencies and remove the cycle checks in
// tryInterProviderDestroyEdge.
Operation walkOperation
}
// tryInterProviderDestroyEdge checks if we're inserting a destroy edge
@ -81,6 +86,12 @@ func (t *DestroyEdgeTransformer) tryInterProviderDestroyEdge(g *Graph, from, to
e := dag.BasicEdge(from, to)
g.Connect(e)
// If this is a complete destroy operation, then there are no create/update
// nodes to worry about and we can accept the edge without deeper inspection.
if t.Operation == walkDestroy {
return
}
// getComparableProvider inspects the node to try and get the most precise
// description of the provider being used to help determine if 2 nodes are
// from the same provider instance.