#[non_exhaustive]pub struct EvalContext {
pub workspace_root: Arc<Path>,
pub environment: Option<Arc<str>>,
pub env_vars: EnvVarMode,
pub repo_vars: Map,
pub cascade_locals: Map,
pub funcs: Arc<FuncRegistry>,
pub limits: EvalLimits,
}Expand description
Read-only inputs to a single crate::eval::Evaluator::evaluate call.
repo_vars and cascade_locals are insertion-ordered Maps (see
10-data-model.md § 2.3) — order preservation matters for the canonical
JSON in error diagnostics. funcs is an Arc<FuncRegistry> so the same
table is shared across all components in a workspace without cloning.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.workspace_root: Arc<Path>Absolute, canonicalised workspace root. All sandboxed file functions validate paths against this root.
environment: Option<Arc<str>>Optional environment name (e.g. Some("staging")). Bound as the
terraform.workspace placeholder for the evaluator pass; downstream
resource rows surface it in the environment column.
env_vars: EnvVarModeHow get_env(...) reads the process environment.
repo_vars: Mapvar.* bindings from .tfvars and CLI --var k=v flags.
cascade_locals: Maplocal.* shadows injected from a Terragrunt cascade (Phase 6 will
populate this; Phase 4 accepts an empty map and a synthetic one for
tests).
funcs: Arc<FuncRegistry>Registered functions (stdlib + Terraform-only + sandboxed file + Terragrunt helpers).
limits: EvalLimitsPer-call resource limits.
Implementations§
Source§impl EvalContext
impl EvalContext
Sourcepub fn new(
workspace_root: Arc<Path>,
environment: Option<Arc<str>>,
env_vars: EnvVarMode,
repo_vars: Map,
cascade_locals: Map,
funcs: Arc<FuncRegistry>,
limits: EvalLimits,
) -> Self
pub fn new( workspace_root: Arc<Path>, environment: Option<Arc<str>>, env_vars: EnvVarMode, repo_vars: Map, cascade_locals: Map, funcs: Arc<FuncRegistry>, limits: EvalLimits, ) -> Self
Construct a fully-specified EvalContext. Public because
downstream crates (the CLI, the future server) build contexts
from their own config sources; the struct is #[non_exhaustive]
so the constructor is the stable surface even when fields evolve.
Sourcepub fn minimal(workspace_root: Arc<Path>) -> Result<Self, ValidationError>
pub fn minimal(workspace_root: Arc<Path>) -> Result<Self, ValidationError>
Construct a minimal context pinned to workspace_root with default
limits, empty repo_vars / cascade_locals, an empty registry,
and strict env-var mode (empty allowlist). Convenience for tests
and the default CLI invocation.
§Errors
Returns ValidationError::Empty when workspace_root is an empty
path — the evaluator requires a non-empty root for the sandboxed
path helpers to reject escapes meaningfully.
Sourcepub fn lookup_repo_var(&self, name: &str) -> Option<&Value>
pub fn lookup_repo_var(&self, name: &str) -> Option<&Value>
Read a binding for name from repo_vars.
Sourcepub fn lookup_cascade_local(&self, name: &str) -> Option<&Value>
pub fn lookup_cascade_local(&self, name: &str) -> Option<&Value>
Read a binding for name from cascade_locals.
Trait Implementations§
Source§impl Clone for EvalContext
impl Clone for EvalContext
Source§fn clone(&self) -> EvalContext
fn clone(&self) -> EvalContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more