mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-23 07:33:32 -06:00
cb2e9119aa
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package addrs
|
|
|
|
import "fmt"
|
|
|
|
// MoveEndpointKind represents the different kinds of object that a movable
|
|
// address can refer to.
|
|
type MoveEndpointKind rune
|
|
|
|
//go:generate go run golang.org/x/tools/cmd/stringer -type MoveEndpointKind
|
|
|
|
const (
|
|
// MoveEndpointModule indicates that a move endpoint either refers to
|
|
// an individual module instance or to all instances of a particular
|
|
// module call.
|
|
MoveEndpointModule MoveEndpointKind = 'M'
|
|
|
|
// MoveEndpointResource indicates that a move endpoint either refers to
|
|
// an individual resource instance or to all instances of a particular
|
|
// resource.
|
|
MoveEndpointResource MoveEndpointKind = 'R'
|
|
)
|
|
|
|
func absMoveableEndpointKind(addr AbsMoveable) MoveEndpointKind {
|
|
switch addr := addr.(type) {
|
|
case ModuleInstance, AbsModuleCall:
|
|
return MoveEndpointModule
|
|
case AbsResourceInstance, AbsResource:
|
|
return MoveEndpointResource
|
|
default:
|
|
// The above should be exhaustive for all AbsMoveable types.
|
|
panic(fmt.Sprintf("unsupported address type %T", addr))
|
|
}
|
|
}
|