blob: 82d8586513218543c0610e5c79de3f5782ec847e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package dynblock
import (
"github.com/hashicorp/hcl/v2"
"github.com/zclconf/go-cty/cty"
)
type ExpandOption interface {
applyExpandOption(*expandBody)
}
type optCheckForEach struct {
check func(cty.Value, hcl.Expression, *hcl.EvalContext) hcl.Diagnostics
}
func OptCheckForEach(check func(cty.Value, hcl.Expression, *hcl.EvalContext) hcl.Diagnostics) ExpandOption {
return optCheckForEach{check}
}
// applyExpandOption implements ExpandOption.
func (o optCheckForEach) applyExpandOption(body *expandBody) {
body.checkForEach = append(body.checkForEach, o.check)
}
|