Not sure whether that's a problem with me or a bug but here is what I'm trying to do:
I wrote a function in my bake file to compute a list of targets based on an whether an env var (MY_ VERSION) matches a list of versions:
function "exclude_if_version" {
params = [
versions,
inputlist,
excludees
]
result = sethaselement(convert(versions, list(string)),"${MY_VERSION}") ? setsubtract(inputlist, excludees) : inputlist
}
As you can see above, I'd like to deal with cases where someone using that function passes numbers (e.g. [3, 4]) or string representation of the version (["3.0", "4.0"]) in the versions list.
Though when running that simple code I get the error below:
Invalid expression; function "list" does not exist: undefined
I've tried with more simple types and get the same error (e.g. convert("true", bool))
I would have expected that to work given the bake Reference states:
A set of general-purpose functions provided by go-cty are available for use in HCL files
Not sure whether that's a problem with me or a bug but here is what I'm trying to do:
I wrote a function in my bake file to compute a list of targets based on an whether an env var (
MY_ VERSION) matches a list ofversions:As you can see above, I'd like to deal with cases where someone using that function passes numbers (e.g.
[3, 4]) or string representation of the version (["3.0", "4.0"]) in theversionslist.Though when running that simple code I get the error below:
I've tried with more simple types and get the same error (e.g.
convert("true", bool))I would have expected that to work given the bake Reference states: