From aeed8486dce48c1f74b4d91c3c95046726bf2bc3 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Wed, 7 Feb 2024 16:43:30 -0800 Subject: [PATCH] terraform: BuiltinEvalContext function eval in partial-expanded module An earlier commit changed the EvalContext model to support evaluation in both fully-expanded and partial-expanded modules, but the provider-contributed functions feature landed semi-concurrently with it and so inadvertently introduced a codepath that only worked in the fully-expanded case. This will now handle both situations, since all we really need is the addrs.Module, which we can obtain in both modes. --- internal/terraform/eval_context_builtin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/terraform/eval_context_builtin.go b/internal/terraform/eval_context_builtin.go index 04c897012547..3e1853948be5 100644 --- a/internal/terraform/eval_context_builtin.go +++ b/internal/terraform/eval_context_builtin.go @@ -485,7 +485,7 @@ func (ctx *BuiltinEvalContext) evaluationExternalFunctions() lang.ExternalFuncs // by the module author. ret := lang.ExternalFuncs{} - cfg := ctx.Evaluator.Config.DescendentForInstance(ctx.Path()) + cfg := ctx.Evaluator.Config.Descendent(ctx.scope.evalContextScopeModule()) if cfg == nil { // It's weird to not have a configuration by this point, but we'll // tolerate it for robustness and just return no functions at all.