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 snake_case, kebab-case and camelCase functions #80

Closed

Conversation

stephen-harris
Copy link

A lot of cloud resources have names that generally follow a particular string case convention, when incorporating variables into resource names it would be useful to force it to adopt that case style. You can get some way with that in terraform by using functions like title, lower, replace but it would cleaner to provide those functions.

I created these functions here before I saw the comment in #63 - but I'm happy to port these changes into the terraform repository if that is deemed more appropriate.

@codecov
Copy link

codecov bot commented Dec 5, 2020

Codecov Report

Merging #80 (b0060d2) into main (4a53886) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #80      +/-   ##
==========================================
+ Coverage   70.36%   70.47%   +0.11%     
==========================================
  Files          79       79              
  Lines        6550     6575      +25     
==========================================
+ Hits         4609     4634      +25     
  Misses       1497     1497              
  Partials      444      444              
Impacted Files Coverage Δ
cty/function/stdlib/string.go 57.36% <100.00%> (+6.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a53886...b0060d2. Read the comment docs.

@apparentlymart
Copy link
Collaborator

Hi @stephen-harris! Thanks for working on this.

As you anticipated, I'm going to ask that you send these upstream to Terraform instead of here. The surface area of functions in this repository has got quite large and arguably already has some functions that are a little too esoteric, and the Terraform project is better resourced to maintain its large library of functions than I am in this upstream library.

Although I am also a member of the Terraform team at HashiCorp, I'm writing this comment with my "owner of cty" hat on, so a PR in the Terraform repository will need to be discussed among the broader Terraform team to decide if they want to accept it as-is or ask for some naming/design changes; I can't speak on the whole team's behalf here, but FWIW I like the idea and can see the use of it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants