github.com/opentofu/opentofu@v1.7.1/internal/instances/instance_key_data.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 instances
     7  
     8  import (
     9  	"github.com/zclconf/go-cty/cty"
    10  )
    11  
    12  // RepetitionData represents the values available to identify individual
    13  // repetitions of a particular object.
    14  //
    15  // This corresponds to the each.key, each.value, and count.index symbols in
    16  // the configuration language.
    17  type RepetitionData struct {
    18  	// CountIndex is the value for count.index, or cty.NilVal if evaluating
    19  	// in a context where the "count" argument is not active.
    20  	//
    21  	// For correct operation, this should always be of type cty.Number if not
    22  	// nil.
    23  	CountIndex cty.Value
    24  
    25  	// EachKey and EachValue are the values for each.key and each.value
    26  	// respectively, or cty.NilVal if evaluating in a context where the
    27  	// "for_each" argument is not active. These must either both be set
    28  	// or neither set.
    29  	//
    30  	// For correct operation, EachKey must always be either of type cty.String
    31  	// or cty.Number if not nil.
    32  	EachKey, EachValue cty.Value
    33  }