Azure Automation Variable

im trying to use a count that is based on the existence and value of am Azure Automation Account variable. The plan stage is able to refresh the automation variable, so during plan the value is know.

what i am triyng to do

service_is_deployed = data.azurerm_automation_variable_int.service_deployed.value
data "azurerm_automation_variable_int" "service_deployed" {
  name                    = "service_deployed"
  resource_group_name     = data.azurerm_resource_group.rg.name
  automation_account_name = azurerm_automation_account.service.name
}

data "terraform_remote_state" "azureadc_service" {
  count = local.service_is_deployed == 1 ? 1:0
  backend = "azurerm"

  config = {
    resource_group_name  = "rg"
    storage_account_name = "remotestorage"
    container_name       = "tfstate"
    key = var.remote_cs_terraform_state_filename

}
}

but i keep getting the error that the value wont be known until apply and there for the plan fails. any suggestions ?