Local values by conditional

Hello guys,
have such a TF variables

variable "hostname" { default = "host.fqdn" }
variable "instance_class" {
    default = "proxy"
#    default = "consumer"
}

locals {
    consumer_instance_settings = {
        "${var.instance_class == "consumer" ? var.hostname : "" }"  = { av_zone = local.zone, subnet = local.subnet }
    }
}

locals {
    proxy_instance_settings = {
        "${var.instance_class == "proxy" ? var.hostname : "" }"  = { av_zone = local.zone, subnet = local.subnet }
    }
}

so the case is to separate locals by instance_class variable.
if instance class == proxy use only local.proxy_instance_settings
if instance class == consumer use only local.consumer_instance_settings
Now I get empty output hostnamed resource if conditional is false : "" }"