github.com/hashicorp/packer@v1.14.3/hcl2template/testdata/variables/validation/invalid_default.pkr.hcl (about)

     1  
     2  variable "image_id" {
     3    type    = string
     4    default = "potato"
     5    validation {
     6      condition     = length(var.image_id) > 4 && substr(var.image_id, 0, 4) == "ami-"
     7      error_message = "The image_id value must be a valid AMI id, starting with \"ami-\"."
     8    }
     9  }