Execute_command attempts to run variables

I have a Azure ADO pipeline that runs my packer build on a linux agent. In the template I have shell-local provsioner that runs a powershell script that is defined like:


environment_vars = [“Server={var.vcenter_server.PDC}","User={var.username}”,“Password={var.password}","VM={var.vm_name.eight}”]

execute_command     = ["/bin/bash", "-c", "{{.Vars}} /usr/bin/pwsh {{.Script}}"]

env_var_format      = "$env:%s='%s'; "

scripts             = ["scripts/removedisk.ps1"]

Everytime the script runs it tries to run the .Vars as a script also. I’ve tried different variations of the execute_command but cannot get the shell-local provsioner to run correctly. What is the correct way to get the script to run?

Maybe I’m stupid, but why not get rid of the brackets,
ditch the “/bin/bash -c” and change {{.Script}} into {{ .Path }},
like you’d see in the examples, with only bash changed into pwsh ?