mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
1dece66b10
This package aims to encapsulate the module/resource repetition problem so that Terraform Core's graph node DynamicExpand implementations can be simpler. This is also a building block on the path towards module repetition, by modelling the recursive expansion of modules and their contents. This will allow the Terraform Core plan graph to have one node per configuration construct, each of which will DynamicExpand into as many sub-nodes as necessary to cover all of the recursive module instantiations. For the moment this is just dead code, because Terraform Core isn't yet updated to use it.
29 lines
927 B
Go
29 lines
927 B
Go
package instances
|
|
|
|
import (
|
|
"github.com/zclconf/go-cty/cty"
|
|
)
|
|
|
|
// RepetitionData represents the values available to identify individual
|
|
// repetitions of a particular object.
|
|
//
|
|
// This corresponds to the each.key, each.value, and count.index symbols in
|
|
// the configuration language.
|
|
type RepetitionData struct {
|
|
// CountIndex is the value for count.index, or cty.NilVal if evaluating
|
|
// in a context where the "count" argument is not active.
|
|
//
|
|
// For correct operation, this should always be of type cty.Number if not
|
|
// nil.
|
|
CountIndex cty.Value
|
|
|
|
// EachKey and EachValue are the values for each.key and each.value
|
|
// respectively, or cty.NilVal if evaluating in a context where the
|
|
// "for_each" argument is not active. These must either both be set
|
|
// or neither set.
|
|
//
|
|
// For correct operation, EachKey must always be either of type cty.String
|
|
// or cty.Number if not nil.
|
|
EachKey, EachValue cty.Value
|
|
}
|