github.com/pulumi/terraform@v1.4.0/pkg/addrs/move_endpoint_kind.go (about)

     1  package addrs
     2  
     3  import "fmt"
     4  
     5  // MoveEndpointKind represents the different kinds of object that a movable
     6  // address can refer to.
     7  type MoveEndpointKind rune
     8  
     9  //go:generate go run golang.org/x/tools/cmd/stringer -type MoveEndpointKind
    10  
    11  const (
    12  	// MoveEndpointModule indicates that a move endpoint either refers to
    13  	// an individual module instance or to all instances of a particular
    14  	// module call.
    15  	MoveEndpointModule MoveEndpointKind = 'M'
    16  
    17  	// MoveEndpointResource indicates that a move endpoint either refers to
    18  	// an individual resource instance or to all instances of a particular
    19  	// resource.
    20  	MoveEndpointResource MoveEndpointKind = 'R'
    21  )
    22  
    23  func absMoveableEndpointKind(addr AbsMoveable) MoveEndpointKind {
    24  	switch addr := addr.(type) {
    25  	case ModuleInstance, AbsModuleCall:
    26  		return MoveEndpointModule
    27  	case AbsResourceInstance, AbsResource:
    28  		return MoveEndpointResource
    29  	default:
    30  		// The above should be exhaustive for all AbsMoveable types.
    31  		panic(fmt.Sprintf("unsupported address type %T", addr))
    32  	}
    33  }