mirror of https://github.com/hashicorp/packer
HCL: add tests and fixes around var-file and var args (#8914)
parent
7979ab0543
commit
ad8dafa3bd
@ -0,0 +1,2 @@
|
||||
|
||||
fruit = "apple"
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"fruit": "apple"
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
|
||||
fruit = "chocolate" // is that even a fruit !?
|
||||
@ -0,0 +1,20 @@
|
||||
{
|
||||
"variables": {
|
||||
"fruit": ""
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"communicator": "none",
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
[
|
||||
{
|
||||
"name": "apple",
|
||||
"type": "shell-local",
|
||||
"inline": [ "echo {{ user `fruit` }} > {{ user `fruit` }}.txt" ]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
variable "fruit" {
|
||||
type = string
|
||||
}
|
||||
|
||||
source "null" "builder" {
|
||||
communicator = "none"
|
||||
}
|
||||
|
||||
build {
|
||||
sources = [
|
||||
"source.null.builder",
|
||||
]
|
||||
|
||||
provisioner "shell-local" {
|
||||
inline = ["echo ${var.fruit} > ${var.fruit}.txt"]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue