-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
HCL2: Add "strcontains" function support #13191
Comments
I attempted to start adding support for this via zclconf/go-cty#193 but completely overlooked the licensing issue. Looking at https://github.com/hashicorp/go-cty-funcs there's not an existing place that seems obvious to add support. I could just add it to https://github.com/hashicorp/packer/tree/main/hcl2template/function. Do the maintainers have any preference for how to go about adding this? |
Hey @jaredledvina, This is a good idea indeed! I see you had a chat with @apparentlymart over on CTY, he pretty much nailed it; I don't think we want to deal with potential legal issues between licenses, so do feel free to adapt Terraform's code for the function in Packer itself, no need to upstream that in a MIT project, even if it seems the better option from a technical standpoint, I don't want us to get dragged into a legal argument. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.
Description
I would love to see the Packer HCL2 syntax support the
strcontains
function similar to what is currently supported over in Terraform. This function is a really nice quick helper to do a contains comparison.Use Case(s)
The primary use case is writing conditionals that depend on if a string is within another. For example if the source_ami name contains "test" or not.
Potential configuration
Potential References
https://developer.hashicorp.com/terraform/language/functions/strcontains
The text was updated successfully, but these errors were encountered: