newbie question: How to call string upper/lower in templates

4,438 views
Skip to first unread message

Alexander Gray II

unread,
Nov 6, 2015, 6:37:53 PM11/6/15
to Terraform
I feel silly posting this question, but how do I call string lower or upper in templates?

This doesn't work:
name        = "${lower(${var.database_name}-${var.engine_type}-${var.instance_name}-${var.environment})}"
Nor this:
name        = "${lower({var.database_name}-{var.engine_type}-{var.instance_name}-{var.environment})}"
Nor this:
name        = "${lower(var.database_name-var.engine_type-var.instance_name-var.environment)}"

I'm missing something fundamental here...

Thanks,

Alex

Clint Shryock

unread,
Nov 10, 2015, 11:25:25 AM11/10/15
to terrafo...@googlegroups.com
Hey Alex –

Sorry for the delay in response, hopefully you've gotten this sorted, but in case not:

the latter example should do it. I've created this gist to demonstrate:

- https://gist.github.com/catsby/c66a99208783de6af104

In short, `${lower(var.key)}` does the trick for me

Hope this helps!

--
Clint

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/21515d20-a31f-4748-87c1-adb0e86e17fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Clint
Reply all
Reply to author
Forward
0 new messages