diff --git a/hcl2template/testdata/variables/validation/invalid_default.pkr.hcl b/hcl2template/testdata/variables/validation/invalid_default.pkr.hcl new file mode 100644 index 000000000..4fafe369f --- /dev/null +++ b/hcl2template/testdata/variables/validation/invalid_default.pkr.hcl @@ -0,0 +1,9 @@ + +variable "image_id" { + type = string + default = "potato" + validation { + condition = length(var.image_id) > 4 && substr(var.image_id, 0, 4) == "ami-" + error_message = "The image_id value must be a valid AMI id, starting with \"ami-\"." + } +} diff --git a/hcl2template/testdata/variables/validation/valid.pkr.hcl b/hcl2template/testdata/variables/validation/valid.pkr.hcl index a0bbe2cf5..e17aa7193 100644 --- a/hcl2template/testdata/variables/validation/valid.pkr.hcl +++ b/hcl2template/testdata/variables/validation/valid.pkr.hcl @@ -6,4 +6,4 @@ variable "image_id" { condition = length(var.image_id) > 4 && substr(var.image_id, 0, 4) == "ami-" error_message = "The image_id value must be a valid AMI id, starting with \"ami-\"." } -} \ No newline at end of file +}