Concatenate a text in the boot_command tag

Sorry for the possible spelling errors, I’m Brazilian. I’m trying to concatenate a variable from my code with a text from boot_command, but I’m getting some errors, could someone tell me why?
block boot_command isolated:

 boot_command = [
    "ip address add dev {{ .var.rede_interface }}<enter>",

block var_rede_interface isolated:

variable "rede_interface" {
  type = string

the value of the variable is in the script “” and is being loaded by the command “packer build scriptMain.pkr.hcl”

i am getting the following error:
Build ‘virtualbox-iso.tupaDebian’ errored after 1 minute 13 seconds: Error preparing boot command: template: root:1:767: executing “root” at <.rede_interface>: can’t evaluate field rede_interface in type *common.bootCommandTemplateData

Maybe try the “${}” syntax?

1 Like