mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
73053eb5ef
Some of the objects that are referencable from expressions are transient values computed only during a graph walk, and not persisted in state. In order to support arbitrary evaluation of expressions, such as in the "terraform console" CLI command, it's necessary to be able to evaluate these values before we start evaluating. This new Eval method achieves this by performing a special graph walk that ignores resources (except for dependency resolution) and just focuses on evaluating all of these transient values, before returning an evaluation scope that can then resolve expressions in terms of that result. This replaces the Context.Interpolator method, which was fraught with various issues due to it not properly priming the state before evaluating.
20 lines
420 B
Go
20 lines
420 B
Go
package terraform
|
|
|
|
//go:generate stringer -type=walkOperation graph_walk_operation.go
|
|
|
|
// walkOperation is an enum which tells the walkContext what to do.
|
|
type walkOperation byte
|
|
|
|
const (
|
|
walkInvalid walkOperation = iota
|
|
walkInput
|
|
walkApply
|
|
walkPlan
|
|
walkPlanDestroy
|
|
walkRefresh
|
|
walkValidate
|
|
walkDestroy
|
|
walkImport
|
|
walkEval // used just to prepare EvalContext for expression evaluation, with no other actions
|
|
)
|