diff options
| author | Martin Atkins <mart@degeneration.co.uk> | 2023-02-02 16:51:44 -0800 |
|---|---|---|
| committer | Martin Atkins <mart@degeneration.co.uk> | 2023-05-31 09:26:15 -0700 |
| commit | e0058a2ccf974b0c676057c3e9156c93929d7366 (patch) | |
| tree | a9ec7475ae709b0b2adfe996e2b7853c86b224ab /json | |
| parent | adb8823497f803aa9c25157529cb392c116fb7e8 (diff) | |
hclsyntax: TemplateExpr can refine its unknown results
If we encounter an interpolated unknown value during template rendering,
we can report the partial buffer we've completed so far as the refined
prefix of the resulting unknown value, which can then potentially allow
downstream comparisons to produce a known false result instead of unknown
if the prefix is sufficient to satisfy them.
Diffstat (limited to 'json')
| -rw-r--r-- | json/structure_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/json/structure_test.go b/json/structure_test.go index d05a1d6..bf6be2f 100644 --- a/json/structure_test.go +++ b/json/structure_test.go @@ -1433,7 +1433,7 @@ func TestExpressionValue_Diags(t *testing.T) { { name: "string: unhappy", src: `{"v": "happy ${UNKNOWN}"}`, - expected: cty.UnknownVal(cty.String), + expected: cty.UnknownVal(cty.String).RefineNotNull(), error: "Unknown variable", }, { @@ -1447,7 +1447,7 @@ func TestExpressionValue_Diags(t *testing.T) { name: "object_val: unhappy", src: `{"v": {"key": "happy ${UNKNOWN}"}}`, expected: cty.ObjectVal(map[string]cty.Value{ - "key": cty.UnknownVal(cty.String), + "key": cty.UnknownVal(cty.String).RefineNotNull(), }), error: "Unknown variable", }, @@ -1472,7 +1472,7 @@ func TestExpressionValue_Diags(t *testing.T) { { name: "array: unhappy", src: `{"v": ["happy ${UNKNOWN}"]}`, - expected: cty.TupleVal([]cty.Value{cty.UnknownVal(cty.String)}), + expected: cty.TupleVal([]cty.Value{cty.UnknownVal(cty.String).RefineNotNull()}), error: "Unknown variable", }, } |
