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

Add more functions (sum, round, map, …) #12760

Open
lindhe opened this issue Dec 18, 2023 · 0 comments
Open

Add more functions (sum, round, map, …) #12760

lindhe opened this issue Dec 18, 2023 · 0 comments

Comments

@lindhe
Copy link

lindhe commented Dec 18, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Please search the existing issues for relevant feature requests, and use the reaction feature to add upvotes to preexisting requests.

Description

I'm missing some numerical functions, such as round() and sum(). If you can come up with more functions, please add those to my list! The more the merrier, at least when it comes to functions.

A map function would also be extremely useful.

Use Case(s)

I think there are plenty of use-cases for sum(). In my particular case right now, I have a number of predefined partitions and I want to create a disk that is slightly larger than the sum of all the partitions (and I'll let the / partition grow to consume any remaining space). Thus I need to sum over an array of numbers and round up.

Potential configuration

round(sum([1, 2, 3, 4.5]))

Potential References

Terraform already have a sum() function: https://developer.hashicorp.com/terraform/language/functions/sum

On this topic: I find it pretty confusing that Terraform and Packer both use HCL but have different functions available to them. Are there any plans to consolidate the two?

@lindhe lindhe changed the title Add more numerical functions (sum, round, …) Add more functions (sum, round, map, …) Dec 18, 2023
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

1 participant