opentofu/terraform/eval_sequence.go

28 lines
492 B
Go
Raw Normal View History

2015-02-04 19:23:26 -06:00
package terraform
// EvalSequence is an EvalNode that evaluates in sequence.
type EvalSequence struct {
Nodes []EvalNode
}
2015-02-14 00:58:41 -06:00
func (n *EvalSequence) Eval(ctx EvalContext) (interface{}, error) {
for _, n := range n.Nodes {
if n == nil {
continue
}
2015-02-14 00:58:41 -06:00
if _, err := EvalRaw(n, ctx); err != nil {
return nil, err
}
2015-02-04 19:23:26 -06:00
}
2015-02-14 00:58:41 -06:00
return nil, nil
2015-02-04 19:23:26 -06:00
}
2015-02-11 10:48:45 -06:00
// EvalNodeFilterable impl.
func (n *EvalSequence) Filter(fn EvalNodeFilterFunc) {
for i, node := range n.Nodes {
n.Nodes[i] = fn(node)
}
}