Replies: 1 comment
-
|
This can also resolve/change a behavior in how With a DAG, that unknown value does not need to be prematurely expanded. Once the DAG eval "stops" or stalemates, remaining unexpanded blocks could be handled differently. Or at least marked in such a way that it is known the At present, it can hide unintentional issues. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Current evaluation model
In the current model, all configuration blocks are evaluated sequentially and repeatedly - pass after pass - until the values in the context stabilize (stop changing).
How it works:
Drawbacks of the iterative model:
Redundant calculations: Many blocks may be recalculated multiple times even after their values have stabilized.
Potentially long running time: For large configurations with complex dependencies, many passes may be needed.
Difficult to control evaluation order: There is no strict computation order, making it hard to determine which blocks influence the result at any point.
There are a few issues that are hard to solve:
Proposal
Implement configuration evaluation by building a block dependency graph based on implicit dependencies extracted from expressions (references to resources, variables, locals, modules, etc).
Options
1. Full graph with topological sorting
In this approach, a complete dependency graph between blocks is constructed, and all blocks are evaluated in topological order.
Pros:
Minuses:
2. Lazy on-demand evaluation
Block values are computed only by explicit request. Missing dependencies are recursively calculated and cached.
Pros:
Minuses:
3. Hybrid approach
The hybrid approach involves building the complete dependency graph upfront without performing immediate computations. Evaluation is done lazily, with caching of computed values triggered only when specific values are requested. Additionally, it supports full graph traversal and evaluation of all blocks on demand or by using an explicit flag.
Benefits:
Key points for Implementation
localsinto separate blocks with typelocaland the name of each local variable; this is necessary because local variables can reference themselves or each other.defaultexpression in variable blocks for evaluation.hcl.Traversalexpressions.Target
None
Scanner
Misconfiguration
Beta Was this translation helpful? Give feedback.
All reactions