github.com/trawler/terraform@v0.10.8-0.20171106022149-4b1c7a1d9b48/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  // GraphNodeSubPath
    23  func (n *NodeOutputOrphan) Path() []string {
    24  	return n.PathValue
    25  }
    26  
    27  // GraphNodeEvalable
    28  func (n *NodeOutputOrphan) EvalTree() EvalNode {
    29  	return &EvalOpFilter{
    30  		Ops: []walkOperation{walkRefresh, walkApply, walkDestroy},
    31  		Node: &EvalDeleteOutput{
    32  			Name: n.OutputName,
    33  		},
    34  	}
    35  }