2024-02-08 03:48:59 -06:00
|
|
|
// Copyright (c) The OpenTofu Authors
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
2023-05-02 10:33:06 -05:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2018-06-07 19:27:57 -05:00
|
|
|
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
|