»The source block

The top-level source block defines reusable builder configuration blocks:

# sources.pkr.hcl
source "amazon-ebs" "example-1" {
    // ...
}

You can start builders by refering to those source blocks form a build block, for example :

build {
  source = [
    # Here Packer will use a default ami_name when saving the image.
    "sources.amazon-ebs.example",
    "sources.amazon-ebs.foo",
  ]
}

The build-level source block allows to set specific source fields.

build {
  source "sources.amazon-ebs.example" {
    # Here Packer will use the provided ami_name instead of defaulting it.
    ami_name = "specific"
  }
}

»Related