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

lang/funcs: Add camelCase, kebab-case and snake_case functions #27357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stephen-harris
Copy link

No description provided.

@hashicorp-cla
Copy link

hashicorp-cla commented Dec 22, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Dec 22, 2020

Codecov Report

Merging #27357 (33934ed) into master (c0e37a7) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
lang/funcs/string.go 100.00% <100.00%> (ø)
lang/functions.go 96.35% <100.00%> (+0.08%) ⬆️
terraform/evaluate.go 52.89% <0.00%> (+0.41%) ⬆️
terraform/node_resource_plan.go 98.05% <0.00%> (+1.94%) ⬆️

@pranaygp
Copy link

I would love this @teamterraform :)

@dhirschfeld
Copy link

This PR has been languishing for a long time now 😞

Could someone from @teamterraform please comment on whether or not this contribution will be accepted if the conflicts are resolved?

@Shrirang97
Copy link

Shrirang97 commented Oct 21, 2021

@teamterraform I am in urgent need of these functions. I was writing logic in my tf module when I saw this PR.
Please let us know when these changes will get merged? A lot of people are waiting for this feature.
I can work on whatever is left.
It has been almost a year for such a simple but very useful feature.

@sobi3ch
Copy link

sobi3ch commented Oct 28, 2021

@teamterraform Can we please have a look at it. This will save hours of work for many of us. Thanks! ❤️

return KebabCaseFunc.Call([]cty.Value{str})
}

// KebabCase is a Function that converts a given string to kebab-case.
Copy link

@sikachu sikachu Nov 12, 2021

Choose a reason for hiding this comment

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

Sorry for jumping in, but I just noticed this typo in the comment

Suggested change
// KebabCase is a Function that converts a given string to kebab-case.
// CamelCase is a Function that converts a given string to camelCase.

Copy link

Choose a reason for hiding this comment

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

// CamelCase is a Function that converts a given string to camelCase.

Copy link

Choose a reason for hiding this comment

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

Fixed, thank you!

@dnck
Copy link

dnck commented Jan 24, 2022

Bumping! Would be nice to have this in terraform :)

@shayan-golafshani
Copy link

Bumping again! I'm new to TF and this would be great to have.

@felipefrocha
Copy link

felipefrocha commented Apr 8, 2022

This wasn't released yet right?
Could that be included to convert json keys during jsondecode, as a optional parameter?

@crw
Copy link
Collaborator

crw commented Apr 8, 2022

This PR is in a holding pattern for now, please see this comment: #28855 (comment), specifically:

We're being pretty cautious about adding new functions that overlap with existing use-cases because Terraform has grown quite an unwieldy collection of builtins over the years, and so we've been considering various ways to allow for externally-defined functions (e.g. #2771) to avoid continuing to grow that set. However, that's not something we'll be working on in the very near future, due to our current focus being elsewhere, so we'll revisit this at a later time and post any updates in those other issues.

Just an FYI as to why this hasn't been reviewed. The conversation is active but there are no updates as to externally-defined functions. Once that has been designed, it will be easier to determine which of the existing requests for functions belong in core versus belong outside of core.

@Shrirang97
Copy link

@teamterraform any update on this?

@crw
Copy link
Collaborator

crw commented Oct 19, 2022

@Shrirang97 no updates at this time.

@jonmcewen
Copy link

@crw @teamterraform
9 months on; what are your latest thoughts on this please?

@crw
Copy link
Collaborator

crw commented Jul 6, 2023

@jonmcewen #27357 (comment)

For what it is worth, I am continuing to champion the extendable functions concept. However, there is no update to share.

@millouzgc
Copy link

Hello, it would really be a plus in the integration of csv files from providers like Google.
a concrete example on Google alert monitoring, it's possible to export in csv (Camel Case).
The need would be to convert all map ids to Snake Case and integrate the file into Terraform even more easily.

@crw
Copy link
Collaborator

crw commented Oct 23, 2023

Just FYI, #27696 (comment)

@mcm-ham
Copy link

mcm-ham commented Jun 9, 2024

Is anyone interested in making a provider for these functions? #2771

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

Successfully merging this pull request may close these issues.