I have a `locals` block as follows:

```
locals {
  database_server_name = var.createDatabaseServer ? azurerm_postgresql_server.region[0].name : var.postgresqlServerName
}

```

Unfortunately, it seems like Terraform wants to evaluate the tuple (`region[0]`), despite not having to in every scenario:

```
Error: Invalid index

  on terraform/region/03-database.tf line 34, in locals:
  34:   database_server_name = var.createDatabaseServer ? azurerm_postgresql_server.region[0].name : var.postgresqlServerName
    |----------------
    | azurerm_postgresql_server.region is empty tuple

```

Is there any way to accomplish what I want above where a default value (`var.postgresqlServerName`) can be used in situations where the tuple is empty?