mirror of https://github.com/hashicorp/terraform
Previously we had states.DeposedKey as our representation of the unique keys used to differentiate between multiple deposed objects on the same resource instance. That type is useful in various places, but its presence in the "states" package made it troublesome to import for some callers. Since its purpose is as an identifier, this type is more at home in the "addrs" package. The states package retains a small number of aliases to preserve compatibility with a few existing callers for now, until we have the stomach for a more invasive change. This also removes the largely-redundant states.Generation interface type, which initially was intended as a way to distinguish between "current" objects and deposed objects, but didn't really add anything because we already have addrs.NotDeposed to represent that situation. Instead, we just ended up with various bits of boilerplate adapter code converting between the two representations. Everything now uses addrs.DeposedKey and uses addrs.NotDeposed to identify non-deposed objects.pull/34738/head
parent
54622c68a5
commit
13e26b60dd
@ -1,23 +0,0 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
package states
|
||||
|
||||
// Generation is used to represent multiple objects in a succession of objects
|
||||
// represented by a single resource instance address. A resource instance can
|
||||
// have multiple generations over its lifetime due to object replacement
|
||||
// (when a change can't be applied without destroying and re-creating), and
|
||||
// multiple generations can exist at the same time when create_before_destroy
|
||||
// is used.
|
||||
//
|
||||
// A Generation value can either be the value of the variable "CurrentGen" or
|
||||
// a value of type DeposedKey. Generation values can be compared for equality
|
||||
// using "==" and used as map keys. The zero value of Generation (nil) is not
|
||||
// a valid generation and must not be used.
|
||||
type Generation interface {
|
||||
generation()
|
||||
}
|
||||
|
||||
// CurrentGen is the Generation representing the currently-active object for
|
||||
// a resource instance.
|
||||
var CurrentGen Generation
|
||||
Loading…
Reference in new issue