mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-27 09:21:14 -06:00
cf46e1c3e0
This disables the computed value check for `count` during the validation pass. This enables partial support for #3888 or #1497: as long as the value is non-computed during the plan, complex values will work in counts. **Notably, this allows data source values to be present in counts!** The "count" value can be disabled during validation safely because we can treat it as if any field that uses `count.index` is computed for validation. We then validate a single instance (as if `count = 1`) just to make sure all required fields are set.
28 lines
492 B
Go
28 lines
492 B
Go
package terraform
|
|
|
|
// EvalSequence is an EvalNode that evaluates in sequence.
|
|
type EvalSequence struct {
|
|
Nodes []EvalNode
|
|
}
|
|
|
|
func (n *EvalSequence) Eval(ctx EvalContext) (interface{}, error) {
|
|
for _, n := range n.Nodes {
|
|
if n == nil {
|
|
continue
|
|
}
|
|
|
|
if _, err := EvalRaw(n, ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
return nil, nil
|
|
}
|
|
|
|
// EvalNodeFilterable impl.
|
|
func (n *EvalSequence) Filter(fn EvalNodeFilterFunc) {
|
|
for i, node := range n.Nodes {
|
|
n.Nodes[i] = fn(node)
|
|
}
|
|
}
|