-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathoptions.go
More file actions
34 lines (30 loc) · 1.05 KB
/
Copy pathoptions.go
File metadata and controls
34 lines (30 loc) · 1.05 KB
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
27
28
29
30
31
32
33
34
package preview
// Option adjusts how Preview evaluates a template. Options exist so a caller
// can change evaluation behavior without a new preview release, for example
// to turn off an optimization that misbehaves on a particular template.
type Option func(*options)
type options struct {
// fullEvaluation disables resource closure pruning so every resource in
// the root module is evaluated.
fullEvaluation bool
}
// OptionFullEvaluation evaluates every resource in the root module instead of
// only those reachable from parameter, preset, and tag blocks. It is the escape
// hatch for the resource closure optimization: parameters, presets, and tags
// are unchanged either way, so this only matters when that optimization has a
// bug, or when Output.ModuleOutput must include outputs that read resources
// outside the closure.
func OptionFullEvaluation() Option {
return func(o *options) {
o.fullEvaluation = true
}
}
func applyOptions(opts []Option) options {
var o options
for _, opt := range opts {
if opt != nil {
opt(&o)
}
}
return o
}