github.com/cycloidio/terraform@v1.1.10-0.20220513142504-76d5c768dc63/addrs/targetable.go (about)

     1  package addrs
     2  
     3  // Targetable is an interface implemented by all address types that can be
     4  // used as "targets" for selecting sub-graphs of a graph.
     5  type Targetable interface {
     6  	targetableSigil()
     7  
     8  	// TargetContains returns true if the receiver is considered to contain
     9  	// the given other address. Containment, for the purpose of targeting,
    10  	// means that if a container address is targeted then all of the
    11  	// addresses within it are also implicitly targeted.
    12  	//
    13  	// A targetable address always contains at least itself.
    14  	TargetContains(other Targetable) bool
    15  
    16  	// AddrType returns the address type for comparison with other Targetable
    17  	// addresses.
    18  	AddrType() TargetableAddrType
    19  
    20  	// String produces a string representation of the address that could be
    21  	// parsed as a HCL traversal and passed to ParseTarget to produce an
    22  	// identical result.
    23  	String() string
    24  }
    25  
    26  type targetable struct {
    27  }
    28  
    29  func (r targetable) targetableSigil() {
    30  }
    31  
    32  type TargetableAddrType int
    33  
    34  const (
    35  	ConfigResourceAddrType TargetableAddrType = iota
    36  	AbsResourceInstanceAddrType
    37  	AbsResourceAddrType
    38  	ModuleAddrType
    39  	ModuleInstanceAddrType
    40  )