Trying to use another variable in validation block

I am trying to use a variable validation in terraform, i am trying to deny role editor and owner while creating new project, however want to keep excpetions for some project. below is my terraform code.
i am getting errors in the validation block for using another variable
can some one help me with this ?

variable "iam_role_member" {
  type = map(list(string))

  validation {
    condition = length(setintersection(toset(keys(var.iam_role_member)),toset["roles/owner","roles/editor"]))) == 0 || length(var.allowed_project_ids) > 0
    error_message = "Project cannot have owner or editor roles."
  }
}

variable "allowed_project_ids" {
  type    = list(string)
  default = []
}

data "github_repository_file" "exception_project_list_id" {
  repository = "organization/exception-project-list-id"
  file_path  = "project-ids.txt"
}

locals {
  exception_project_ids = length(var.allowed_project_ids) > 0 ? data.github_repository_file.exception_project_list_id.content : []
  project_ids           = length(local.exception_project_ids) > 0 ? concat(local.exception_project_ids, var.allowed_project_ids) : var.allowed_project_ids
}

variable "project_ids" {
  type    = list(string)
  default = local.project_ids
}

Variable validation rules must be self-contained – referring only to their own values – because Terraform also checks them in limited evaluation contexts like the terraform validate command, which don’t always have a full evaluation context for the entire module.

This problem might be better solved using a precondition on one of your resources – probably whichever resource is declaring the roles in the remote system – since preconditions are evaluated during the plan and apply phases and so they can make use of any value available within the same module as the condition expression.

okay, thanks, we try to use precondition block to look for solution