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

hcl2template: add strcontains function #13217

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

mogrogan
Copy link
Contributor

The strcontains function check if a sub string is a indeed a subset of a given string.

closes #13191

This function was tested inside the packer console command:

$ ./bin/packer console -config-type=hcl2
> strcontains("abcd", "ab")
> true
> strcontains("abcd", "jk")
false

@mogrogan mogrogan requested a review from a team as a code owner November 26, 2024 17:24
Copy link

hashicorp-cla-app bot commented Nov 26, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mogrogan,

Thanks for the PR, I left a nitpick on how the error checking steps are written in the related test, nothing major, feel free to discuss or implement that, let me know how you want to address that.

Besides that, LGTM, so I'm pre-approving to not be a blocker later on.

hcl2template/function/strcontains_test.go Outdated Show resolved Hide resolved
The strcontains function check if a sub string is a indeed a subset of a
given string.

hcl2template: add strcontains function

The strcontains function check if a sub string is a indeed a subset of a
given string.
@lbajolet-hashicorp
Copy link
Contributor

Thanks for the reroll @mogrogan, this LGTM, merging now!

@lbajolet-hashicorp lbajolet-hashicorp merged commit 0ddcbaf into hashicorp:main Nov 26, 2024
10 of 11 checks passed
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HCL2: Add "strcontains" function support
2 participants