Merge pull request #22119 from hashicorp/b-chunklist-empty-list
lang/funcs: Pass through empty list in chunklist
This commit is contained in:
commit
5c30bafee0
|
@ -392,6 +392,10 @@ var ChunklistFunc = function.New(&function.Spec{
|
||||||
return cty.UnknownVal(retType), nil
|
return cty.UnknownVal(retType), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if listVal.LengthInt() == 0 {
|
||||||
|
return cty.ListValEmpty(listVal.Type()), nil
|
||||||
|
}
|
||||||
|
|
||||||
var size int
|
var size int
|
||||||
err = gocty.FromCtyValue(args[1], &size)
|
err = gocty.FromCtyValue(args[1], &size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1097,6 +1097,12 @@ func TestChunklist(t *testing.T) {
|
||||||
cty.UnknownVal(cty.List(cty.List(cty.String))),
|
cty.UnknownVal(cty.List(cty.List(cty.String))),
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
cty.ListValEmpty(cty.String),
|
||||||
|
cty.NumberIntVal(3),
|
||||||
|
cty.ListValEmpty(cty.List(cty.String)),
|
||||||
|
false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
|
|
Loading…
Reference in New Issue