How to access variable from condition


I want to be able to access a local variable from a condition block. Is this possible? I’m on tf13.

I’m trying to do something similar to this:

locals {
  types = [

variable "myvar" {
  type        = list(map(string))
  default     = []

  validation {
    condition = length([
        for x in var.myvar:
            true if contains(locals.types, lookup(x, "type", "type1"))
    ]) == length(var.myvar)
    error_message = "Invalid type - see locals.types for valid values."