github.com/opentofu/opentofu@v1.7.1/internal/states/instance_generation.go (about)

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