You can add validation rules to ensure that input values meet certain criteria.
variable "instance_type" {
description = "Type of EC2 instance"
type = string
default = "t2.micro"
validation {
condition = contains(["t2.micro", "t2.small", "t2.medium"], var.instance_type)
error_message = "Instance type must be one of t2.micro, t2.small, or t2.medium."
}
}