github.com/hashicorp/terraform-plugin-sdk@v1.17.2/terraform/node_output_orphan.go (about)

     1  package terraform
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/terraform-plugin-sdk/internal/addrs"
     7  )
     8  
     9  // NodeOutputOrphan represents an output that is an orphan.
    10  type NodeOutputOrphan struct {
    11  	Addr addrs.AbsOutputValue
    12  }
    13  
    14  var (
    15  	_ GraphNodeSubPath          = (*NodeOutputOrphan)(nil)
    16  	_ GraphNodeReferenceable    = (*NodeOutputOrphan)(nil)
    17  	_ GraphNodeReferenceOutside = (*NodeOutputOrphan)(nil)
    18  	_ GraphNodeEvalable         = (*NodeOutputOrphan)(nil)
    19  )
    20  
    21  func (n *NodeOutputOrphan) Name() string {
    22  	return fmt.Sprintf("%s (orphan)", n.Addr.String())
    23  }
    24  
    25  // GraphNodeReferenceOutside implementation
    26  func (n *NodeOutputOrphan) ReferenceOutside() (selfPath, referencePath addrs.ModuleInstance) {
    27  	return referenceOutsideForOutput(n.Addr)
    28  }
    29  
    30  // GraphNodeReferenceable
    31  func (n *NodeOutputOrphan) ReferenceableAddrs() []addrs.Referenceable {
    32  	return referenceableAddrsForOutput(n.Addr)
    33  }
    34  
    35  // GraphNodeSubPath
    36  func (n *NodeOutputOrphan) Path() addrs.ModuleInstance {
    37  	return n.Addr.Module
    38  }
    39  
    40  // GraphNodeEvalable
    41  func (n *NodeOutputOrphan) EvalTree() EvalNode {
    42  	return &EvalOpFilter{
    43  		Ops: []walkOperation{walkRefresh, walkApply, walkDestroy},
    44  		Node: &EvalDeleteOutput{
    45  			Addr: n.Addr.OutputValue,
    46  		},
    47  	}
    48  }