Merge pull request #22119 from hashicorp/b-chunklist-empty-list

lang/funcs: Pass through empty list in chunklist
pull/22137/head
Radek Simko 7 years ago committed by GitHub
commit 5c30bafee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -392,6 +392,10 @@ var ChunklistFunc = function.New(&function.Spec{
return cty.UnknownVal(retType), nil
}
if listVal.LengthInt() == 0 {
return cty.ListValEmpty(listVal.Type()), nil
}
var size int
err = gocty.FromCtyValue(args[1], &size)
if err != nil {

@ -1097,6 +1097,12 @@ func TestChunklist(t *testing.T) {
cty.UnknownVal(cty.List(cty.List(cty.String))),
false,
},
{
cty.ListValEmpty(cty.String),
cty.NumberIntVal(3),
cty.ListValEmpty(cty.List(cty.String)),
false,
},
}
for i, test := range tests {

Loading…
Cancel
Save