github.com/wikibal01/hashicorp-terraform@v0.11.12-beta1/terraform/node_output_orphan.go (about)

     1  package terraform
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // NodeOutputOrphan represents an output that is an orphan.
     8  type NodeOutputOrphan struct {
     9  	OutputName string
    10  	PathValue  []string
    11  }
    12  
    13  func (n *NodeOutputOrphan) Name() string {
    14  	result := fmt.Sprintf("output.%s (orphan)", n.OutputName)
    15  	if len(n.PathValue) > 1 {
    16  		result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result)
    17  	}
    18  
    19  	return result
    20  }
    21  
    22  // GraphNodeReferenceable
    23  func (n *NodeOutputOrphan) ReferenceableName() []string {
    24  	return []string{"output." + n.OutputName}
    25  }
    26  
    27  // GraphNodeSubPath
    28  func (n *NodeOutputOrphan) Path() []string {
    29  	return n.PathValue
    30  }
    31  
    32  // GraphNodeEvalable
    33  func (n *NodeOutputOrphan) EvalTree() EvalNode {
    34  	return &EvalOpFilter{
    35  		Ops: []walkOperation{walkRefresh, walkApply, walkDestroy},
    36  		Node: &EvalDeleteOutput{
    37  			Name: n.OutputName,
    38  		},
    39  	}
    40  }