github.com/hashicorp/packer@v1.14.3/command/test-fixtures/hcl/validation/map/definition.pkr.hcl (about)

     1  
     2  variable "image_metadata" {
     3    default = {
     4      key: "value",
     5      something: { 
     6        foo: "bar",
     7      }
     8    }
     9    validation {
    10      condition     = length(var.image_metadata.key) > 4
    11      error_message = "The image_metadata.key field must be more than 4 runes."
    12    }
    13    validation {
    14      condition     = substr(var.image_metadata.something.foo, 0, 3) == "bar"
    15      error_message = "The image_metadata.something.foo field must start with \"bar\"."
    16    }
    17  }
    18  
    19  source "null" "test" {
    20    communicator = "none"
    21  }
    22  
    23  build {
    24    sources = ["source.null.test"]
    25  }