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 ToLower & ToUpper template functions for config.TemplatedStringAsIdentifier #190

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

ulucinar
Copy link
Collaborator

Description of your changes

This PR adds ToLower and ToUpper template functions that can be used in the template body passed to config.TemplatedStringAsIdentifier. With these template functions, it will be possible to specify an external-name configuration such as the following:

config.TemplatedStringAsIdentifier("", "arn:aws:network-firewall:{{ .setup.configuration.region }}:{{ .setup.client_metadata.account_id }}:{{ .parameters.type | ToLower }}-rulegroup/{{ .external_name }}"),

, where the value of the type parameter will be converted to lower case and used as a component while constructing the Terraform ID.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Tested manually in the context of crossplane-contrib/provider-upjet-aws#661.

Copy link
Member

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

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

Thanks @ulucinar LGTM!

…Identifier

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
@ulucinar ulucinar merged commit 1268a48 into crossplane:main Apr 18, 2023
@ulucinar ulucinar deleted the template-funcs branch April 18, 2023 10:25
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.

2 participants