Skip to content

Instantly share code, notes, and snippets.

@robzr
Last active March 18, 2020 02:20
Show Gist options
  • Save robzr/01a3a4da52bd85342528fc9a7c8246ab to your computer and use it in GitHub Desktop.
Save robzr/01a3a4da52bd85342528fc9a7c8246ab to your computer and use it in GitHub Desktop.
Packer HCL file demonstrating local variable reference issue
variable "test" {
default = "default value" # Remove this line to cause Packer to crash
}
locals {
test = var.test
}
source "null" "null" {
communicator = "none"
}
build {
sources = ["source.null.null"]
provisioner "shell-local" {
command = "echo var.test=\"${var.test}\" local.test=\"${local.test}\""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment