From 3a31ce9c2840d5de4e395dbfe433fb8a2dcb06a8 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 5 Sep 2025 13:39:12 -0700 Subject: [PATCH] configgraph: ContributingResourceInstances uses ValueMarksOfTypeDeep Recent changes in cty have included some new functions for working with marks more efficiently. This particular function allows us to iterate over the deep marks on a value without creating a new unmarked copy of the value and without building an intermediate map of marks. Signed-off-by: Martin Atkins --- .../eval/internal/configgraph/resource_instance_deps.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/lang/eval/internal/configgraph/resource_instance_deps.go b/internal/lang/eval/internal/configgraph/resource_instance_deps.go index 83a9f76b9a..9fa8ceede5 100644 --- a/internal/lang/eval/internal/configgraph/resource_instance_deps.go +++ b/internal/lang/eval/internal/configgraph/resource_instance_deps.go @@ -58,13 +58,10 @@ func ContributingResourceInstances(v cty.Value) iter.Seq[*ResourceInstance] { // multiple references to the same resource instance as long as the // pointers are unique, but the doc comment above reserves the right // to change our approach here in future, if needed.) - _, marks := v.UnmarkDeep() return func(yield func(*ResourceInstance) bool) { - for mark := range marks { - if mark, ok := mark.(ResourceInstanceMark); ok { - if !yield(mark.instance) { - break - } + for mark := range cty.ValueMarksOfTypeDeep[ResourceInstanceMark](v) { + if !yield(mark.instance) { + break } } }