HCL2: version block: test validation & document version/availability (#10298)
* HCL2: Test that the packer block passes in packer validate * HCL2: Test invalid packer blocks are invalid * docs: state from which version the packer block is available
This commit is contained in:
parent
c5da8c5c37
commit
73b7499811
|
@ -1,3 +1,7 @@
|
|||
packer {
|
||||
required_version = ">= v1.0.0"
|
||||
}
|
||||
|
||||
source "file" "chocolate" {
|
||||
target = "chocolate.txt"
|
||||
content = "chocolate"
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
packer {
|
||||
version = ">= v1.0.0"
|
||||
}
|
|
@ -26,6 +26,9 @@ func TestValidateCommand(t *testing.T) {
|
|||
|
||||
// wrong version field
|
||||
{path: filepath.Join(testFixture("version_req", "wrong_field_name")), exitCode: 1},
|
||||
|
||||
// wrong packer block
|
||||
{path: filepath.Join(testFixture("validate", "invalid_packer_block.pkr.hcl")), exitCode: 1},
|
||||
}
|
||||
|
||||
for _, tc := range tt {
|
||||
|
|
|
@ -11,6 +11,8 @@ description: |-
|
|||
|
||||
`@include 'from-1.5/beta-hcl2-note.mdx'`
|
||||
|
||||
-> **Note:** The Packer block is only available in Packer v1.6.5 and later.
|
||||
|
||||
The `packer` configuration block type is used to configure some
|
||||
behaviors of Packer itself, such as the minimum required Packer version needed to
|
||||
apply your configuration.
|
||||
|
|
Loading…
Reference in New Issue