I am trying to do some kind of parameterizatiim inside one of the pkrvars.hcl files. I would like to have urls pointing to some resource to be using some other variables, like:
Lib_url = "https://lib-name-${version}`
Where version comes from other packer variables file. I can see that using variables is not possible this way. The question is - is it possible to use a variable/local value of a valie of some other variable in packer variables file?
What you can do is have a
variable
which is configurable at runtime (either with a var-file, or-var
or an env varPKG_VAR_var
, see https://www.packer.io/guides/hcl/variables) and have other "variables" namedlocals
which derive from this variable. See https://www.packer.io/docs/templates/hcl_templates/localsan example
Then in your build you use those variables with
${local.apt_url}