opentofu/addrs/targetable.go
Martin Atkins 02b25e7057 addrs: flesh out functionality ready to replace terraform.ResourceAddress
This "kitchen sink" commit is mainly focused on supporting "targets" as
a new sub-category of addresses, for use-case like the -target CLI option,
but also includes some other functionality to get closer to replacing
terraform.ResourceAddress and fill out some missing parts for representing
various other address types that are currently represented as strings
in the "terraform" package.
2018-10-16 18:44:26 -07:00

27 lines
818 B
Go

package addrs
// Targetable is an interface implemented by all address types that can be
// used as "targets" for selecting sub-graphs of a graph.
type Targetable interface {
targetableSigil()
// TargetContains returns true if the receiver is considered to contain
// the given other address. Containment, for the purpose of targeting,
// means that if a container address is targeted then all of the
// addresses within it are also implicitly targeted.
//
// A targetable address always contains at least itself.
TargetContains(other Targetable) bool
// String produces a string representation of the address that could be
// parsed as a HCL traversal and passed to ParseTarget to produce an
// identical result.
String() string
}
type targetable struct {
}
func (r targetable) targetableSigil() {
}