Error: Function calls not allowed - Env problems?

Hi Everyone, sorry in advance if this is a newbie problem but it’s getting annoying :neutral_face:
Packer v1.6.5

I am trying to follow the Getting Start documentation but everytime I try to get environment variables for example following the firstrun.pkr.hcl I got the error:
Error: Function calls not allowed on firstrun.pkr.hcl line 7, in variable "ami_name": 7: default = "${env("CUSTOM_AMI_NAME")}" Functions may not be called here.
Had the exact same problem trying to get AWS credencials from env vars, and I am following everything without skipping any step, does someone know if I am forgetting some setting?

Have you tried using the current Packer version 1.6.6?

Looking at the changelog it says

New function env allows users to set the default value of a variable to the value of an environment variable. Please see env function docs for more details. [GH-10240]

1 Like