Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(how) can I use convert function? #2813

Open
alxgomz opened this issue Nov 22, 2024 · 0 comments
Open

(how) can I use convert function? #2813

alxgomz opened this issue Nov 22, 2024 · 0 comments

Comments

@alxgomz
Copy link

alxgomz commented Nov 22, 2024

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 target based on an env var:

function "trim_from_major" {
  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 convert in case someone uses that function passes numbers or string representation of the versions 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants