From 6ec71247d9d00d0e22cc0d33636844380bc11463 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 6 Oct 2023 10:39:26 -0700 Subject: [PATCH] hclsyntax: New tests for marks+refinments together The interactions between value marks and unknown value refinements can be a little tricky, so this pair of new tests cover two examples of that interaction that are currently working and ought to stay that way. --- hclsyntax/expression_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hclsyntax/expression_test.go b/hclsyntax/expression_test.go index 6f761023..1af93dad 100644 --- a/hclsyntax/expression_test.go +++ b/hclsyntax/expression_test.go @@ -1397,6 +1397,26 @@ upper( }).Mark("sensitive"), 0, }, + { // splat with sensitive collection that's unknown + `maps.*.enabled`, + &hcl.EvalContext{ + Variables: map[string]cty.Value{ + "maps": cty.UnknownVal(cty.List(cty.Map(cty.Bool))).Mark("sensitive"), + }, + }, + cty.UnknownVal(cty.List(cty.Bool)).RefineNotNull().Mark("sensitive"), + 0, + }, + { // splat with sensitive collection that's unknown and not null + `maps.*.enabled`, + &hcl.EvalContext{ + Variables: map[string]cty.Value{ + "maps": cty.UnknownVal(cty.List(cty.Map(cty.Bool))).RefineNotNull().Mark("sensitive"), + }, + }, + cty.UnknownVal(cty.List(cty.Bool)).RefineNotNull().Mark("sensitive"), + 0, + }, { // splat with collection with sensitive elements `maps.*.x`, &hcl.EvalContext{