mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Rather than maintain a separate graph builder for destroy, use the normal plan graph with some extra options. Utilize the same pattern as the validate graph for now, where we take the normal plan graph builder and inject a new concrete function for the destroy nodes.
18 lines
393 B
Go
18 lines
393 B
Go
package terraform
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/internal/dag"
|
|
)
|
|
|
|
func DestroyPlanGraphBuilder(p *PlanGraphBuilder) GraphBuilder {
|
|
p.ConcreteResourceInstance = func(a *NodeAbstractResourceInstance) dag.Vertex {
|
|
return &NodePlanDestroyableResourceInstance{
|
|
NodeAbstractResourceInstance: a,
|
|
skipRefresh: p.skipRefresh,
|
|
}
|
|
}
|
|
p.destroy = true
|
|
|
|
return p
|
|
}
|