diff --git a/cty/function/stdlib/format.go b/cty/function/stdlib/format.go index 63881f58..8b177589 100644 --- a/cty/function/stdlib/format.go +++ b/cty/function/stdlib/format.go @@ -114,6 +114,8 @@ var FormatListFunc = function.New(&function.Spec{ continue } iterators[i] = arg.ElementIterator() + case arg == cty.DynamicVal: + unknowns[i] = true default: singleVals[i] = arg } diff --git a/cty/function/stdlib/format_test.go b/cty/function/stdlib/format_test.go index 2a8db6ca..aad73a8f 100644 --- a/cty/function/stdlib/format_test.go +++ b/cty/function/stdlib/format_test.go @@ -836,6 +836,15 @@ func TestFormatList(t *testing.T) { cty.UnknownVal(cty.List(cty.String)), ``, }, + 23: { + cty.StringVal("%v"), + []cty.Value{cty.DynamicVal}, + // The current Function implementation will default to DynamicVal + // if AllowUnknown is true, even though this function has a static + // return type + cty.DynamicVal, + ``, + }, } for i, test := range tests {