We have a requirement to create an Azure storage account in Terraform. However, the naming convention required is to combine three declared variables, meaning the module will look something like the below:
resource "azurerm_storage_account" "example" {
name = "(var.first)(var.second)(var.third)"
resource_group_name = "rg01"
location = "uksouth"
account_tier = "Standard"
account_replication_type = "GRS"
It's become a bit of a struggle trying to achieve this and having pored over the Terraform guides, there doesn't appear to be any function that can enable us achieve this. Any ideas or suggestions?
You can use format():
resource "azurerm_storage_account" "example" {
name = format("%s%s%s", var.first, var.second, var.third)
resource_group_name = "rg01"
location = "uksouth"
account_tier = "Standard"
account_replication_type = "GRS"