In Terraform, is it possible to change the casing of values?

1.7k Views Asked by At

I have an ID of a resource and the ID states that the value is known as "/Subscriptions/xxxxxxx-xxxxxx-xxxxxx-xxxxx/" and when leveraging the data resource, "azurerm_subscription "current" ", to get the current subscription data, I get the output of "/subscriptions/xxxxxxx-xxxxxx-xxxxxx-xxxxx/".

You will notice that the only difference between the two values is the Upper case S in the word "Subscriptions". When making terraform changes to use "azurerm_subscription.current.id", instead of hardcoding the Subscription ID value in other resources, it fails to acknowledge the syntax is the same and is telling me that I need to replace the resource I am working with (in this situation I am working with a data disk on a vm). I do not want to destroy the disk and recreate it using just a different casing of the word subscription.

Is this task possible? Am I able to place anything into the main.tf file I am working with to change this casing? I have tried "title(data.azurerm_subscription.current.id)" and it does work in changing the s to an upper case S, however, it also makes all other "first words" that start with an alphabet letter upper case as well (not desired result). I just want to upper case the very first word.

Kind of a loaded question, but any thoughts on this?

0

There are 0 best solutions below