Return variables from shell provisioner into packer variables

This may be a stupid question. not sure if this is even possible

I know how to push variables into a shell provisioner process… but is it even possible to return variables so packer can use them for future … like tagging images

example:…

export NGINX_VERSION=$(nginx -v)

then in the tagging process (bad example here)

{
"tags": {
    "nginx_version": "{{env `NGINX_VERSION`}}",
  }
}

Did you just try it out in the meantime?

strangely no, I read every piece of documentation I could find about the env process relating to exporting shell vars back into packer. couldn’t find any.

if this works … then well… lol awesome.

ill give it a go :wink:

1 Like