mirror of https://github.com/hashicorp/packer
hcl2_upgrade escaped quotes fix (#10794)
* clean up extra quoting that can cause text template failures. when everyone else abandons you, regex will always be there. * LINTINGpull/10779/head
parent
1e312ebc21
commit
0993c976fa
@ -0,0 +1,31 @@
|
||||
|
||||
variable "conf" {
|
||||
type = string
|
||||
default = "${env("ONE")}-${env("ANOTHER")}-${env("BACKTICKED")}"
|
||||
}
|
||||
|
||||
variable "manyspaces" {
|
||||
type = string
|
||||
default = "${env("ASDFASDF")}"
|
||||
}
|
||||
|
||||
variable "nospaces" {
|
||||
type = string
|
||||
default = "${env("SOMETHING")}"
|
||||
}
|
||||
|
||||
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
|
||||
# The "legacy_isotime" function has been provided for backwards compatability, but we recommend switching to the timestamp and formatdate functions.
|
||||
|
||||
source "null" "autogenerated_1" {
|
||||
communicator = "none"
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["source.null.autogenerated_1"]
|
||||
|
||||
provisioner "shell-local" {
|
||||
inline = ["echo ${var.conf}-${local.timestamp}-${legacy_isotime("01-02-2006")}"]
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
{
|
||||
"variables": {
|
||||
"conf": "{{ env \"ONE\" }}-{{env \"ANOTHER\"}}-{{ env `BACKTICKED` }}",
|
||||
"nospaces": "{{env \"SOMETHING\"}}",
|
||||
"manyspaces": "{{ env \"ASDFASDF\"}}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"type": "null",
|
||||
"communicator": "none"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"echo {{user \"conf\"}}-{{timestamp}}-{{isotime \"01-02-2006\"}}"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in new issue