Here is my code
formatted_name = var.resource_type == “virtual_machine” ? format(“vm-%s-00”, substr(local.truncated_base_name, 0, 12)) :
var.resource_type == “key_vault” ? lower(format(“kv-%s”, var.base_name)) :
var.resource_type == “storage_account” ? lower(replace(format(“sa%s”, var.base_name), “-“, “”)) :
var.base_name
getting the following error
Error: Invalid expression
│
│ on ../modules/naming/main.tf line 4, in locals:
│ 4: formatted_name = var.resource_type == “virtual_machine” ? format(“vm-%s-00”, substr(local.truncated_base_name, 0, 12)) :
│ 5: var.resource_type == “key_vault” ? lower(format(“kv-%s”, var.base_name)) :
│
│ Expected the start of an expression, but found an invalid expression token.
╵
╷
│ Error: Argument or block definition required
│
│ on ../modules/naming/main.tf line 5, in locals:
│ 5: var.resource_type == “key_vault” ? lower(format(“kv-%s”, var.base_name)) :
│
│ An argument or block definition is required here. To set an argument, use the equals sign “=” to introduce the argument value.
I tried different ways but keep still getting the same error, any help.
Rama is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.