github.com/hashicorp/packer@v1.14.3/website/content/partials/from-1.5/builds/example-block.mdx (about)

     1  ```hcl
     2  # build.pkr.hcl
     3  build {
     4      # use the `name` field to name a build in the logs.
     5      # For example this present config will display
     6      # "buildname.amazon-ebs.example-1" and "buildname.amazon-ebs.example-2"
     7      name = "buildname"
     8  
     9      sources = [
    10          # use the optional plural `sources` list to simply use a `source`
    11          # without changing any field.
    12          "source.amazon-ebs.example-1",
    13      ]
    14  
    15      source "source.amazon-ebs.example-2" {
    16          # Use the singular `source` block set specific fields.
    17          # Note that fields cannot be overwritten, in other words, you cannot
    18          # set the 'output' field from the top-level source block and here.
    19          output = "different value"
    20          name = "differentname"
    21      }
    22  
    23      provisioner "shell" {
    24          scripts = fileset(".", "scripts/{install,secure}.sh")
    25      }
    26  
    27      post-processor "shell-local" {
    28          inline = ["echo Hello World from ${source.type}.${source.name}"]
    29      }
    30  }
    31  ```