-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variables not recognized #8681
Comments
Hi @tbanyai! Thanks for reaching out. |
@sylviamoss Is there a list of functions that currently work (or don't work) for HCL2?
By this do you mean use the values as literals instead of variables or something else? |
I believe that currently, no functions are working in HCL2 templates -- we have a PR open implementing functions, here: #8588. If you scroll to the store_artifacts build, you can click through and pull a binary testing that behavior out, or you can wait until the v1.5.2 release which should contain that PR :) Yes, I believe Moss was suggesting hardcoding instead of using variables in the meantime. |
OK, thanks for the clarification. In this case I will delay upgrading until 1.5.2 comes out because my real scripts uses variables extensively. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I am trying to migrate my docker builds to Packer 1.5/HCL2 (in the hope so I can split up the single monolithic scripts and share the provisioners between my other scripts building ami images). However the user variables do not seem to work, for example running this simple case:
variables {
source_image= "centos:7.3.1611"
username= "blahblahuser"
}
source "docker" "base_setup"{
image= "{{user
source_image
}}"commit= true
}
build {
sources = [
"docker.base_setup"
]
provisioner "shell" {
inline= [
"useradd -m -s /bin/bash -G wheel {{user
username
}}",]
}
}
ends up in this error:
Error: render 'image': template: root:1:2: executing "root" at <user
source_image
>: error calling user: test in:{{user
source_image
}}on spark_image_docker_1.pkr.hcl line 7, in source "docker" "base_setup":
7: source "docker" "base_setup"{
==> Builds finished but no artifacts were created.
Any ideas?
The text was updated successfully, but these errors were encountered: