github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/states/instance_generation.go (about)

     1  package states
     2  
     3  // Generation is used to represent multiple objects in a succession of objects
     4  // represented by a single resource instance address. A resource instance can
     5  // have multiple generations over its lifetime due to object replacement
     6  // (when a change can't be applied without destroying and re-creating), and
     7  // multiple generations can exist at the same time when create_before_destroy
     8  // is used.
     9  //
    10  // A Generation value can either be the value of the variable "CurrentGen" or
    11  // a value of type DeposedKey. Generation values can be compared for equality
    12  // using "==" and used as map keys. The zero value of Generation (nil) is not
    13  // a valid generation and must not be used.
    14  type Generation interface {
    15  	generation()
    16  }
    17  
    18  // CurrentGen is the Generation representing the currently-active object for
    19  // a resource instance.
    20  var CurrentGen Generation
    21  
    22  type currentGen struct{}
    23  
    24  func (g currentGen) generation() {}