github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/states/instance_generation.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 package states 5 6 // Generation is used to represent multiple objects in a succession of objects 7 // represented by a single resource instance address. A resource instance can 8 // have multiple generations over its lifetime due to object replacement 9 // (when a change can't be applied without destroying and re-creating), and 10 // multiple generations can exist at the same time when create_before_destroy 11 // is used. 12 // 13 // A Generation value can either be the value of the variable "CurrentGen" or 14 // a value of type DeposedKey. Generation values can be compared for equality 15 // using "==" and used as map keys. The zero value of Generation (nil) is not 16 // a valid generation and must not be used. 17 type Generation interface { 18 generation() 19 } 20 21 // CurrentGen is the Generation representing the currently-active object for 22 // a resource instance. 23 var CurrentGen Generation