github.com/ratanraj/packer@v1.3.2/website/source/docs/templates/builders.html.md (about)

     1  ---
     2  description: |
     3      Within the template, the builders section contains an array of all the
     4      builders that Packer should use to generate machine images for the template.
     5  layout: docs
     6  page_title: 'Builders - Templates'
     7  sidebar_current: 'docs-templates-builders'
     8  ---
     9  
    10  # Template Builders
    11  
    12  Within the template, the builders section contains an array of all the builders
    13  that Packer should use to generate machine images for the template.
    14  
    15  Builders are responsible for creating machines and generating images from them
    16  for various platforms. For example, there are separate builders for EC2, VMware,
    17  VirtualBox, etc. Packer comes with many builders by default, and can also be
    18  extended to add new builders.
    19  
    20  This documentation page will cover how to configure a builder in a template. The
    21  specific configuration options available for each builder, however, must be
    22  referenced from the documentation for that specific builder.
    23  
    24  Within a template, a section of builder definitions looks like this:
    25  
    26  ``` json
    27  {
    28    "builders": [
    29      // ... one or more builder definitions here
    30    ]
    31  }
    32  ```
    33  
    34  ## Builder Definition
    35  
    36  A single builder definition maps to exactly one
    37  [build](/docs/basics/terminology.html#term-build). A builder definition is a
    38  JSON object that requires at least a `type` key. The `type` is the name of the
    39  builder that will be used to create a machine image for the build.
    40  
    41  In addition to the `type`, other keys configure the builder itself. For example,
    42  the AWS builder requires an `access_key`, `secret_key`, and some other settings.
    43  These are placed directly within the builder definition.
    44  
    45  An example builder definition is shown below, in this case configuring the AWS
    46  builder:
    47  
    48  ``` json
    49  {
    50    "type": "amazon-ebs",
    51    "access_key": "...",
    52    "secret_key": "..."
    53  }
    54  ```
    55  
    56  ## Named Builds
    57  
    58  Each build in Packer has a name. By default, the name is just the name of the
    59  builder being used. In general, this is good enough. Names only serve as an
    60  indicator in the output of what is happening. If you want, however, you can
    61  specify a custom name using the `name` key within the builder definition.
    62  
    63  This is particularly useful if you have multiple builds defined that use the
    64  same underlying builder. In this case, you must specify a name for at least one
    65  of them since the names must be unique.
    66  
    67  ## Communicators
    68  
    69  Every build is associated with a single
    70  [communicator](/docs/templates/communicator.html). Communicators are used to
    71  establish a connection for provisioning a remote machine (such as an AWS
    72  instance or local virtual machine).
    73  
    74  All the examples for the various builders show some communicator (usually SSH),
    75  but the communicators are highly customizable so we recommend reading the
    76  [communicator documentation](/docs/templates/communicator.html).