opentofu/terraform/node_provider_eval.go
Martin Atkins 73053eb5ef core: Context.Eval method
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.
2018-10-16 18:46:46 -07:00

21 lines
513 B
Go

package terraform
// NodeEvalableProvider represents a provider during an "eval" walk.
// This special provider node type just initializes a provider and
// fetches its schema, without configuring it or otherwise interacting
// with it.
type NodeEvalableProvider struct {
*NodeAbstractProvider
}
// GraphNodeEvalable
func (n *NodeEvalableProvider) EvalTree() EvalNode {
addr := n.Addr
relAddr := addr.ProviderConfig
return &EvalInitProvider{
TypeName: relAddr.Type,
Addr: addr.ProviderConfig,
}
}