use EvalContext.Path to get module path for deprecation surpression

I decided against it before since a lot of tests were panicing, but after consulting with peers I found out the tests were just minimally set up and before it was just fine without the current scope being set. Now we require it to be set as it would in a normal execution therefore I had to add a bit of setup to the tests
This commit is contained in:
Daniel Schmidt 2026-01-12 15:35:57 +01:00
parent 958a1ae1e7
commit 5b40f274b2
20 changed files with 78 additions and 78 deletions

View file

@ -4412,6 +4412,7 @@ module "sink" {
}))
}
// TODO: Shouldn't this one live in https://github.com/hashicorp/terraform/pull/38006
func TestContext2Validate_deprecated_resource(t *testing.T) {
m := testModuleInline(t, map[string]string{
"main.tf": `

View file

@ -10,7 +10,6 @@ import (
"github.com/zclconf/go-cty/cty/gocty"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/terraform/internal/addrs"
"github.com/hashicorp/terraform/internal/lang/marks"
"github.com/hashicorp/terraform/internal/tfdiags"
)
@ -29,8 +28,8 @@ import (
// true instead permits unknown values, indicating them by returning the
// placeholder value -1. Callers can assume that a return value of -1 without
// any error diagnostics represents a valid unknown value.
func evaluateCountExpression(expr hcl.Expression, ctx EvalContext, moduleAddr addrs.Module, allowUnknown bool) (int, tfdiags.Diagnostics) {
countVal, diags := evaluateCountExpressionValue(expr, ctx, moduleAddr)
func evaluateCountExpression(expr hcl.Expression, ctx EvalContext, allowUnknown bool) (int, tfdiags.Diagnostics) {
countVal, diags := evaluateCountExpressionValue(expr, ctx)
if !allowUnknown && !countVal.IsKnown() {
// Currently this is a rather bad outcome from a UX standpoint, since we have
// no real mechanism to deal with this situation and all we can do is produce
@ -75,7 +74,7 @@ func evaluateCountExpression(expr hcl.Expression, ctx EvalContext, moduleAddr ad
// evaluateCountExpressionValue is like evaluateCountExpression
// except that it returns a cty.Value which must be a cty.Number and can be
// unknown.
func evaluateCountExpressionValue(expr hcl.Expression, ctx EvalContext, moduleAddr addrs.Module) (cty.Value, tfdiags.Diagnostics) {
func evaluateCountExpressionValue(expr hcl.Expression, ctx EvalContext) (cty.Value, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
nullCount := cty.NullVal(cty.Number)
if expr == nil {
@ -103,7 +102,7 @@ func evaluateCountExpressionValue(expr hcl.Expression, ctx EvalContext, moduleAd
})
}
countVal, deprecationDiags := ctx.Deprecations().Validate(countVal, moduleAddr, expr.Range().Ptr())
countVal, deprecationDiags := ctx.Deprecations().Validate(countVal, ctx.Path().Module(), expr.Range().Ptr())
diags = diags.Append(deprecationDiags)
// Sensitive values are allowed in count but not for_each. This is a

View file

@ -34,7 +34,10 @@ func TestEvaluateCountExpression(t *testing.T) {
t.Run(name, func(t *testing.T) {
ctx := &MockEvalContext{}
ctx.installSimpleEval()
countVal, diags := evaluateCountExpression(test.Expr, ctx, addrs.RootModule, false)
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
})
countVal, diags := evaluateCountExpression(test.Expr, scopedCtx, false)
if len(diags) != 0 {
t.Errorf("unexpected diagnostics %s", spew.Sdump(diags))
@ -54,7 +57,10 @@ func TestEvaluateCountExpression_ephemeral(t *testing.T) {
expr := hcltest.MockExprLiteral(cty.NumberIntVal(8).Mark(marks.Ephemeral))
ctx := &MockEvalContext{}
ctx.installSimpleEval()
_, diags := evaluateCountExpression(expr, ctx, addrs.RootModule, false)
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
})
_, diags := evaluateCountExpression(expr, scopedCtx, false)
if !diags.HasErrors() {
t.Fatalf("unexpected success; want error")
}
@ -83,7 +89,10 @@ func TestEvaluateCountExpression_allowUnknown(t *testing.T) {
t.Run(name, func(t *testing.T) {
ctx := &MockEvalContext{}
ctx.installSimpleEval()
countVal, diags := evaluateCountExpression(test.Expr, ctx, addrs.RootModule, true)
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
})
countVal, diags := evaluateCountExpression(test.Expr, scopedCtx, true)
if len(diags) != 0 {
t.Errorf("unexpected diagnostics %s", spew.Sdump(diags))

View file

@ -19,13 +19,13 @@ import (
// evaluateForEachExpression differs from evaluateForEachExpressionValue by
// returning an error if the count value is not known, and converting the
// cty.Value to a map[string]cty.Value for compatibility with other calls.
func evaluateForEachExpression(expr hcl.Expression, ctx EvalContext, module addrs.Module, allowUnknown bool) (forEach map[string]cty.Value, known bool, diags tfdiags.Diagnostics) {
return newForEachEvaluator(expr, ctx, module, allowUnknown).ResourceValue()
func evaluateForEachExpression(expr hcl.Expression, ctx EvalContext, allowUnknown bool) (forEach map[string]cty.Value, known bool, diags tfdiags.Diagnostics) {
return newForEachEvaluator(expr, ctx, allowUnknown).ResourceValue()
}
// forEachEvaluator is the standard mechanism for interpreting an expression
// given for a "for_each" argument on a resource, module, or import.
func newForEachEvaluator(expr hcl.Expression, ctx EvalContext, module addrs.Module, allowUnknown bool) *forEachEvaluator {
func newForEachEvaluator(expr hcl.Expression, ctx EvalContext, allowUnknown bool) *forEachEvaluator {
if ctx == nil {
panic("nil EvalContext")
}
@ -33,7 +33,6 @@ func newForEachEvaluator(expr hcl.Expression, ctx EvalContext, module addrs.Modu
return &forEachEvaluator{
ctx: ctx,
expr: expr,
moduleAddr: module,
allowUnknown: allowUnknown,
}
}
@ -50,8 +49,6 @@ type forEachEvaluator struct {
ctx EvalContext
expr hcl.Expression
moduleAddr addrs.Module
// TEMP: If allowUnknown is set then we skip the usual restriction that
// unknown values are not allowed in for_each. A caller that sets this
// must therefore be ready to deal with the result being unknown.
@ -331,8 +328,7 @@ func (ev *forEachEvaluator) validateResourceOrActionForEach(forEachVal cty.Value
}
// We don't care about the returned value here, only the diagnostics
module := addrs.RootModule // TODO: FIXME
_, deprecationDiags := ev.ctx.Deprecations().Validate(forEachVal, module, ev.expr.Range().Ptr())
_, deprecationDiags := ev.ctx.Deprecations().Validate(forEachVal, ev.ctx.Path().Module(), ev.expr.Range().Ptr())
diags = diags.Append(deprecationDiags)

View file

@ -83,7 +83,10 @@ func TestEvaluateForEachExpression_valid(t *testing.T) {
t.Run(name, func(t *testing.T) {
ctx := &MockEvalContext{}
ctx.installSimpleEval()
forEachMap, _, diags := evaluateForEachExpression(test.Expr, ctx, addrs.RootModule, false)
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
})
forEachMap, _, diags := evaluateForEachExpression(test.Expr, scopedCtx, false)
if len(diags) != 0 {
t.Errorf("unexpected diagnostics %s", spew.Sdump(diags))
@ -202,7 +205,10 @@ func TestEvaluateForEachExpression_errors(t *testing.T) {
t.Run(name, func(t *testing.T) {
ctx := &MockEvalContext{}
ctx.installSimpleEval()
_, _, diags := evaluateForEachExpression(test.Expr, ctx, addrs.RootModule, false)
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
})
_, _, diags := evaluateForEachExpression(test.Expr, scopedCtx, false)
if len(diags) != 1 {
t.Fatalf("got %d diagnostics; want 1", len(diags))
@ -262,7 +268,10 @@ func TestEvaluateForEachExpression_allowUnknown(t *testing.T) {
t.Run(name, func(t *testing.T) {
ctx := &MockEvalContext{}
ctx.installSimpleEval()
_, known, diags := evaluateForEachExpression(test.Expr, ctx, addrs.RootModule, true)
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
})
_, known, diags := evaluateForEachExpression(test.Expr, scopedCtx, true)
// With allowUnknown set, all of these expressions should be treated
// as valid for_each values.
@ -285,7 +294,10 @@ func TestEvaluateForEachExpressionKnown(t *testing.T) {
t.Run(name, func(t *testing.T) {
ctx := &MockEvalContext{}
ctx.installSimpleEval()
diags := newForEachEvaluator(expr, ctx, addrs.RootModule, false).ValidateResourceValue()
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
})
diags := newForEachEvaluator(expr, scopedCtx, false).ValidateResourceValue()
if len(diags) != 0 {
t.Errorf("unexpected diagnostics %s", spew.Sdump(diags))

View file

@ -115,7 +115,7 @@ func (n *nodeExpandActionDeclaration) recordActionData(ctx EvalContext, addr add
switch {
case n.Config.Count != nil:
count, countDiags := evaluateCountExpression(n.Config.Count, ctx, n.ModulePath(), false)
count, countDiags := evaluateCountExpression(n.Config.Count, ctx, false)
diags = diags.Append(countDiags)
if countDiags.HasErrors() {
return diags
@ -130,7 +130,7 @@ func (n *nodeExpandActionDeclaration) recordActionData(ctx EvalContext, addr add
}
case n.Config.ForEach != nil:
forEach, known, forEachDiags := evaluateForEachExpression(n.Config.ForEach, ctx, n.ModulePath(), false)
forEach, known, forEachDiags := evaluateForEachExpression(n.Config.ForEach, ctx, false)
diags = diags.Append(forEachDiags)
if forEachDiags.HasErrors() {
return diags

View file

@ -57,7 +57,7 @@ func (n *NodeValidatableAction) Execute(ctx EvalContext, _ walkOperation) tfdiag
// Basic type-checking of the count argument. More complete validation
// of this will happen when we DynamicExpand during the plan walk.
_, countDiags := evaluateCountExpressionValue(n.Config.Count, ctx, n.ModulePath())
_, countDiags := evaluateCountExpressionValue(n.Config.Count, ctx)
diags = diags.Append(countDiags)
case n.Config.ForEach != nil:
@ -67,7 +67,7 @@ func (n *NodeValidatableAction) Execute(ctx EvalContext, _ walkOperation) tfdiag
}
// Evaluate the for_each expression here so we can expose the diagnostics
forEachDiags := newForEachEvaluator(n.Config.ForEach, ctx, n.ModulePath(), false).ValidateActionValue()
forEachDiags := newForEachEvaluator(n.Config.ForEach, ctx, false).ValidateActionValue()
diags = diags.Append(forEachDiags)
}

View file

@ -14,7 +14,6 @@ import (
"github.com/hashicorp/terraform/internal/configs"
"github.com/hashicorp/terraform/internal/dag"
"github.com/hashicorp/terraform/internal/lang/langrefs"
"github.com/hashicorp/terraform/internal/lang/marks"
"github.com/hashicorp/terraform/internal/tfdiags"
)
@ -240,22 +239,3 @@ func evaluateLocalValue(config *configs.Local, localAddr addrs.LocalValue, addrS
}
return val, diags
}
func validateExprUsingDeprecatedValues(val cty.Value, expr hcl.Expression) tfdiags.Diagnostics {
var diags tfdiags.Diagnostics
_, pvms := val.UnmarkDeepWithPaths()
for _, pvm := range pvms {
for m := range pvm.Marks {
if depMark, ok := m.(marks.DeprecationMark); ok {
diags = diags.Append(
&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Deprecated value used",
Detail: depMark.Message,
Subject: expr.Range().Ptr(),
})
}
}
}
return diags
}

View file

@ -131,7 +131,7 @@ func (n *nodeExpandModule) Execute(globalCtx EvalContext, op walkOperation) (dia
switch {
case n.ModuleCall.Count != nil:
count, ctDiags := evaluateCountExpression(n.ModuleCall.Count, moduleCtx, n.Addr, allowUnknown)
count, ctDiags := evaluateCountExpression(n.ModuleCall.Count, moduleCtx, allowUnknown)
diags = diags.Append(ctDiags)
if diags.HasErrors() {
return diags
@ -144,7 +144,7 @@ func (n *nodeExpandModule) Execute(globalCtx EvalContext, op walkOperation) (dia
}
case n.ModuleCall.ForEach != nil:
forEach, known, feDiags := evaluateForEachExpression(n.ModuleCall.ForEach, moduleCtx, module.Module(), allowUnknown)
forEach, known, feDiags := evaluateForEachExpression(n.ModuleCall.ForEach, moduleCtx, allowUnknown)
diags = diags.Append(feDiags)
if diags.HasErrors() {
return diags
@ -281,11 +281,11 @@ func (n *nodeValidateModule) Execute(globalCtx EvalContext, op walkOperation) (d
// a full expansion, presuming these errors will be caught in later steps
switch {
case n.ModuleCall.Count != nil:
_, countDiags := evaluateCountExpressionValue(n.ModuleCall.Count, moduleCtx, n.ModulePath())
_, countDiags := evaluateCountExpressionValue(n.ModuleCall.Count, moduleCtx)
diags = diags.Append(countDiags)
case n.ModuleCall.ForEach != nil:
forEachDiags := newForEachEvaluator(n.ModuleCall.ForEach, moduleCtx, module.Module(), false).ValidateResourceValue()
forEachDiags := newForEachEvaluator(n.ModuleCall.ForEach, moduleCtx, false).ValidateResourceValue()
diags = diags.Append(forEachDiags)
}

View file

@ -230,7 +230,11 @@ func (n *nodeModuleVariable) Execute(ctx EvalContext, op walkOperation) (diags t
if diags.HasErrors() {
return diags
}
diags = diags.Append(validateExprUsingDeprecatedValues(val, n.Expr))
if n.Expr != nil {
_, deprecationDiags := ctx.Deprecations().Validate(val, n.ModulePath(), n.Expr.Range().Ptr())
diags = diags.Append(deprecationDiags)
}
// Set values for arguments of a child module call, for later retrieval
// during expression evaluation.

View file

@ -528,8 +528,9 @@ If you do intend to export this data, annotate the output value as sensitive by
Subject: n.Config.DeprecatedRange.Ptr(),
})
}
} else {
_, deprecationDiags := ctx.Deprecations().Validate(val, n.ModulePath(), n.Config.Expr.Range().Ptr())
} else if n.Config.Expr != nil {
var deprecationDiags tfdiags.Diagnostics
val, deprecationDiags = ctx.Deprecations().Validate(val, n.ModulePath(), n.Config.Expr.Range().Ptr())
diags = diags.Append(deprecationDiags)
}

View file

@ -32,21 +32,24 @@ func TestNodeApplyableOutputExecute_knownValue(t *testing.T) {
"a": cty.StringVal("b"),
})
ctx.EvaluateExprResult = val
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
}).(*MockEvalContext)
err := node.Execute(ctx, walkApply)
err := node.Execute(scopedCtx, walkApply)
if err != nil {
t.Fatalf("unexpected execute error: %s", err)
}
outputVal := ctx.StateState.OutputValue(addr)
outputVal := scopedCtx.StateState.OutputValue(addr)
if got, want := outputVal.Value, val; !got.RawEquals(want) {
t.Errorf("wrong output value in state\n got: %#v\nwant: %#v", got, want)
}
if !ctx.RefreshStateCalled {
if !scopedCtx.RefreshStateCalled {
t.Fatal("should have called RefreshState, but didn't")
}
refreshOutputVal := ctx.RefreshStateState.OutputValue(addr)
refreshOutputVal := scopedCtx.RefreshStateState.OutputValue(addr)
if got, want := refreshOutputVal.Value, val; !got.RawEquals(want) {
t.Fatalf("wrong output value in refresh state\n got: %#v\nwant: %#v", got, want)
}

View file

@ -446,7 +446,7 @@ func (n *NodeAbstractResource) recordResourceData(ctx EvalContext, addr addrs.Ab
switch {
case n.Config != nil && n.Config.Count != nil:
count, countDiags := evaluateCountExpression(n.Config.Count, ctx, n.ModulePath(), allowUnknown)
count, countDiags := evaluateCountExpression(n.Config.Count, ctx, allowUnknown)
diags = diags.Append(countDiags)
if countDiags.HasErrors() {
return diags
@ -460,7 +460,7 @@ func (n *NodeAbstractResource) recordResourceData(ctx EvalContext, addr addrs.Ab
}
case n.Config != nil && n.Config.ForEach != nil:
forEach, known, forEachDiags := evaluateForEachExpression(n.Config.ForEach, ctx, n.ModulePath(), allowUnknown)
forEach, known, forEachDiags := evaluateForEachExpression(n.Config.ForEach, ctx, allowUnknown)
diags = diags.Append(forEachDiags)
if forEachDiags.HasErrors() {
return diags

View file

@ -842,7 +842,7 @@ func (n *NodeAbstractResourceInstance) plan(
}
// Evaluate the configuration
forEach, _, _ := evaluateForEachExpression(n.Config.ForEach, ctx, n.ModulePath(), false)
forEach, _, _ := evaluateForEachExpression(n.Config.ForEach, ctx, false)
keyData = EvalDataForInstanceKey(n.ResourceInstanceAddr().Resource.Key, forEach)
@ -1843,7 +1843,7 @@ func (n *NodeAbstractResourceInstance) planDataSource(ctx EvalContext, checkRule
objTy := schema.Body.ImpliedType()
priorVal := cty.NullVal(objTy)
forEach, _, _ := evaluateForEachExpression(config.ForEach, ctx, n.ModulePath(), false)
forEach, _, _ := evaluateForEachExpression(config.ForEach, ctx, false)
keyData = EvalDataForInstanceKey(n.ResourceInstanceAddr().Resource.Key, forEach)
checkDiags := evalCheckRules(
@ -2170,7 +2170,7 @@ func (n *NodeAbstractResourceInstance) applyDataSource(ctx EvalContext, planned
return nil, keyData, diags
}
forEach, _, _ := evaluateForEachExpression(config.ForEach, ctx, n.ModulePath(), false)
forEach, _, _ := evaluateForEachExpression(config.ForEach, ctx, false)
keyData = EvalDataForInstanceKey(n.Addr.Resource.Key, forEach)
checkDiags := evalCheckRules(
@ -2504,7 +2504,7 @@ func (n *NodeAbstractResourceInstance) applyProvisioners(ctx EvalContext, state
func (n *NodeAbstractResourceInstance) evalProvisionerConfig(ctx EvalContext, body hcl.Body, self cty.Value, schema *configschema.Block) (cty.Value, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics
forEach, _, forEachDiags := evaluateForEachExpression(n.Config.ForEach, ctx, n.ModulePath(), false)
forEach, _, forEachDiags := evaluateForEachExpression(n.Config.ForEach, ctx, false)
diags = diags.Append(forEachDiags)
keyData := EvalDataForInstanceKey(n.ResourceInstanceAddr().Resource.Key, forEach)

View file

@ -213,7 +213,7 @@ func (n *nodeExpandPlannableResource) expandResourceImports(ctx EvalContext, all
continue
}
forEachData, known, forEachDiags := newForEachEvaluator(imp.Config.ForEach, ctx, n.ModulePath(), allowUnknown).ImportValues()
forEachData, known, forEachDiags := newForEachEvaluator(imp.Config.ForEach, ctx, allowUnknown).ImportValues()
diags = diags.Append(forEachDiags)
if forEachDiags.HasErrors() {
return knownImports, unknownImports, diags

View file

@ -515,7 +515,7 @@ func (n *NodePlannableResourceInstance) managedResourceExecute(ctx EvalContext)
// values, which could result in a post-condition check relying on that
// value being inaccurate. Unless we decide to store the value of the
// for-each expression in state, this is unavoidable.
forEach, _, _ := evaluateForEachExpression(n.Config.ForEach, ctx, n.ModulePath(), false)
forEach, _, _ := evaluateForEachExpression(n.Config.ForEach, ctx, false)
repeatData := EvalDataForInstanceKey(n.ResourceInstanceAddr().Resource.Key, forEach)
checkDiags := evalCheckRules(
@ -645,7 +645,7 @@ func (n *NodePlannableResourceInstance) importState(ctx EvalContext, addr addrs.
return nil, deferred, diags
}
forEach, _, _ := evaluateForEachExpression(n.Config.ForEach, ctx, n.ModulePath(), false)
forEach, _, _ := evaluateForEachExpression(n.Config.ForEach, ctx, false)
keyData := EvalDataForInstanceKey(n.ResourceInstanceAddr().Resource.Key, forEach)
configVal, _, configDiags := ctx.EvaluateBlock(n.Config.Config, schema.Body, nil, keyData)
if configDiags.HasErrors() {

View file

@ -32,7 +32,7 @@ func (n *NodePlannableResourceInstance) listResourceExecute(ctx EvalContext) (di
keyData := EvalDataForInstanceKey(addr.Resource.Key, nil)
if config.ForEach != nil {
forEach, _, _ := evaluateForEachExpression(config.ForEach, ctx, n.ModulePath(), false)
forEach, _, _ := evaluateForEachExpression(config.ForEach, ctx, false)
keyData = EvalDataForInstanceKey(addr.Resource.Key, forEach)
}

View file

@ -69,15 +69,6 @@ func (n *NodeValidatableResource) Execute(ctx EvalContext, op walkOperation) (di
}
}
if n.Schema != nil && n.Schema.Body != nil && n.Schema.Body.Deprecated {
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: fmt.Sprintf("Usage of deprecated resource %q", n.Addr.Resource.Type),
Detail: fmt.Sprintf("The resource %q has been marked as deprecated by its provider. Please check the provider documentation for more information.", n.Addr.Resource.Type),
Subject: &n.Config.DeclRange,
})
}
return diags
}
@ -312,7 +303,7 @@ func (n *NodeValidatableResource) validateResource(ctx EvalContext) tfdiags.Diag
// Basic type-checking of the count argument. More complete validation
// of this will happen when we DynamicExpand during the plan walk.
_, countDiags := evaluateCountExpressionValue(n.Config.Count, ctx, n.ModulePath())
_, countDiags := evaluateCountExpressionValue(n.Config.Count, ctx)
diags = diags.Append(countDiags)
case n.Config.ForEach != nil:
@ -322,7 +313,7 @@ func (n *NodeValidatableResource) validateResource(ctx EvalContext) tfdiags.Diag
}
// Evaluate the for_each expression here so we can expose the diagnostics
forEachDiags := newForEachEvaluator(n.Config.ForEach, ctx, n.ModulePath(), false).ValidateResourceValue()
forEachDiags := newForEachEvaluator(n.Config.ForEach, ctx, false).ValidateResourceValue()
diags = diags.Append(forEachDiags)
}
@ -646,7 +637,7 @@ func (n *NodeValidatableResource) validateImportTargets(ctx EvalContext) tfdiags
return diags
}
forEachData, _, forEachDiags := newForEachEvaluator(imp.Config.ForEach, ctx, n.ModulePath(), true).ImportValues()
forEachData, _, forEachDiags := newForEachEvaluator(imp.Config.ForEach, ctx, true).ImportValues()
diags = diags.Append(forEachDiags)
if forEachDiags.HasErrors() {
return diags

View file

@ -277,6 +277,9 @@ func TestNodeValidatableResource_ValidateResource_managedResourceCount(t *testin
ctx.installSimpleEval()
ctx.ProviderSchemaSchema = mp.GetProviderSchema()
ctx.ProviderProvider = p
scopedCtx := ctx.withScope(evalContextModuleInstance{
Addr: addrs.RootModuleInstance,
})
tests := []struct {
name string
@ -311,7 +314,7 @@ func TestNodeValidatableResource_ValidateResource_managedResourceCount(t *testin
},
}
diags := node.validateResource(ctx)
diags := node.validateResource(scopedCtx)
if diags.HasErrors() {
t.Fatalf("err: %s", diags.Err())
}

View file

@ -98,6 +98,7 @@ func (n *NodeRootVariable) Execute(ctx EvalContext, op walkOperation) tfdiags.Di
Summary: "Deprecated variable got a value",
Detail: n.Config.Deprecated,
Subject: &n.Config.DeprecatedRange,
Context: &n.Config.DeclRange,
})
}