terraform: delete destroy interfaces
This commit is contained in:
parent
d820d186e1
commit
83e093a73e
|
@ -229,22 +229,6 @@ func (n *GraphNodeConfigResource) ProvisionedBy() []string {
|
|||
return result
|
||||
}
|
||||
|
||||
// GraphNodeDestroyable
|
||||
func (n *GraphNodeConfigResource) DestroyNode() GraphNodeDestroy {
|
||||
// If we're already a destroy node, then don't do anything
|
||||
if n.Destroy {
|
||||
return nil
|
||||
}
|
||||
|
||||
result := &graphNodeResourceDestroy{
|
||||
GraphNodeConfigResource: *n.Copy(),
|
||||
Original: n,
|
||||
}
|
||||
result.Destroy = true
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// Same as GraphNodeConfigResource, but for flattening
|
||||
type GraphNodeConfigResourceFlat struct {
|
||||
*GraphNodeConfigResource
|
||||
|
@ -288,27 +272,6 @@ func (n *GraphNodeConfigResourceFlat) ProvisionedBy() []string {
|
|||
prefix)
|
||||
}
|
||||
|
||||
// GraphNodeDestroyable impl.
|
||||
func (n *GraphNodeConfigResourceFlat) DestroyNode() GraphNodeDestroy {
|
||||
// Get our parent destroy node. If we don't have any, just return
|
||||
raw := n.GraphNodeConfigResource.DestroyNode()
|
||||
if raw == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
node, ok := raw.(*graphNodeResourceDestroy)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("unknown destroy node: %s %T", dag.VertexName(raw), raw))
|
||||
}
|
||||
|
||||
// Otherwise, wrap it so that it gets the proper module treatment.
|
||||
return &graphNodeResourceDestroyFlat{
|
||||
graphNodeResourceDestroy: node,
|
||||
PathValue: n.PathValue,
|
||||
FlatCreateNode: n,
|
||||
}
|
||||
}
|
||||
|
||||
type graphNodeResourceDestroyFlat struct {
|
||||
*graphNodeResourceDestroy
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package terraform
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/dag"
|
||||
)
|
||||
|
||||
// GraphNodeDestroy is the interface that must implemented by
|
||||
// nodes that destroy.
|
||||
type GraphNodeDestroy interface {
|
||||
dag.Vertex
|
||||
|
||||
// CreateBeforeDestroy is called to check whether this node
|
||||
// should be created before it is destroyed. The CreateBeforeDestroy
|
||||
// transformer uses this information to setup the graph.
|
||||
CreateBeforeDestroy() bool
|
||||
|
||||
// CreateNode returns the node used for the create side of this
|
||||
// destroy. This must already exist within the graph.
|
||||
CreateNode() dag.Vertex
|
||||
}
|
Loading…
Reference in New Issue