Variable validation to include other-than-self variables in condition

Hi! I have a use case where I need to only allow specific AWS instance types in a certain region.

Specifically, if I’m in the “us-gov-west-1” region, I need to use AWS Nitro instances. I can pre-define a list of those nitro instances before the validation, but need the ability to determine if the restriction is enforceable based on the passed region.

I’d like something like this:

variable “region” {
type = string
default = “us-east-1”
}

variable “nitro_instances” {
type = list(string)
default = [“instance1”, “instance2”] // etc…
}

variable “instance_type” {
type = string
validation {
condition = var.region == “us-gov-west-1” && contains(var.nitro_types, var.instance_type)
error_message = “You need to use nitro in gov”
}
}

Is there a way to accomplish this with the current implementation of terraform? Even if it’s roundabout, or am I barking up the wrong tree?

Thanks in advance!

Andrew