doc ebsvolume builder using partials

This commit is contained in:
Adrien Delorme 2019-06-19 11:50:40 +02:00
parent 4c1abf828c
commit 8cea5d409a
5 changed files with 63 additions and 31 deletions

View File

@ -10,8 +10,6 @@ import (
type BlockDevice struct {
awscommon.BlockDevice `mapstructure:",squash"`
OmitFromArtifact bool `mapstructure:"omit_from_artifact"`
// Tags applied to the AMI. This is a
// template engine, see Build template
// data for more information.
@ -37,13 +35,3 @@ func (bds BlockDevices) Prepare(ctx *interpolate.Context) (errs []error) {
}
return errs
}
func (b BlockDevices) GetOmissions() map[string]bool {
omitMap := make(map[string]bool)
for _, blockDevice := range b {
omitMap[blockDevice.DeviceName] = blockDevice.OmitFromArtifact
}
return omitMap
}

View File

@ -24,8 +24,15 @@ type Config struct {
common.PackerConfig `mapstructure:",squash"`
awscommon.AccessConfig `mapstructure:",squash"`
awscommon.RunConfig `mapstructure:",squash"`
// Add the block device mappings to the AMI. The block device mappings
// allow for keys:
// Add the block device mappings to the AMI. If you add instance store
// volumes or EBS volumes in addition to the root device volume, the
// created AMI will contain block device mapping information for those
// volumes. Amazon creates snapshots of the source instance's root volume
// and any other EBS volumes described here. When you launch an instance
// from this new AMI, the instance automatically launches with these
// additional volumes, and will restore them from snapshots taken from the
// source instance. See the [BlockDevices](#block-devices-configuration)
// documentation for fields.
VolumeMappings BlockDevices `mapstructure:"ebs_volumes" required:"false"`
// Enable enhanced networking (ENA but not SriovNetSupport) on
// HVM-compatible AMIs. If set, add ec2:ModifyInstanceAttribute to your AWS

View File

@ -31,25 +31,56 @@ and key pairs Packer is able to operate on.
## Configuration Reference
There are many configuration options available for the builder. They are
segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized.
In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) can be configured for this
builder.
### Required:
<%= partial "partials/builder/amazon/common/AccessConfig-required" %>
<%= partial "partials/builder/amazon/common/RunConfig-required" %>
There are many configuration options available for the builder. In addition to
the items listed here, you will want to look at the general configuration
references for [AMI](#ami-configuration),
[BlockDevices](#block-devices-configuration),
[Access](#acces-configuration),
[Run](#run-configuration) and
[Communicator](#communicator-configuration)
configuration references, which are
necessary for this build to succeed and can be found further down the page.
### Optional:
<%= partial "partials/builder/amazon/common/AccessConfig-not-required" %>
<%= partial "partials/builder/amazon/common/RunConfig-not-required" %>
<%= partial "partials/builder/amazon/ebsvolume/Config-not-required" %>
### Acces Configuration
#### Required:
<%= partial "partials/builder/amazon/common/AccessConfig-required" %>
#### Optional:
<%= partial "partials/builder/amazon/common/AccessConfig-not-required" %>
### Block Devices Configuration
Block devices can be nested in the
[ebs_volumes](#ebs_volumes) array.
<%= partial "partials/builder/amazon/common/BlockDevice" %>
#### Optional:
<%= partial "partials/builder/amazon/common/BlockDevice-not-required" %>
<%= partial "partials/builder/amazon/ebsvolume/BlockDevice-not-required" %>
### Run Configuration
#### Required:
<%= partial "partials/builder/amazon/common/RunConfig-required" %>
#### Optional:
<%= partial "partials/builder/amazon/common/RunConfig-not-required" %>
### Communicator Configuration
#### Optional:
<%= partial "partials/helper/communicator/Config-not-required" %>
## Basic Example

View File

@ -1,6 +1,5 @@
<!-- Code generated from the comments of the BlockDevice struct in builder/amazon/ebsvolume/block_device.go; DO NOT EDIT MANUALLY -->
- `omit_from_artifact` (bool) - Omit From Artifact
- `tags` (awscommon.TagMap) - Tags applied to the AMI. This is a
template engine, see Build template
data for more information.

View File

@ -1,7 +1,14 @@
<!-- Code generated from the comments of the Config struct in builder/amazon/ebsvolume/builder.go; DO NOT EDIT MANUALLY -->
- `ebs_volumes` (BlockDevices) - Add the block device mappings to the AMI. The block device mappings
allow for keys:
- `ebs_volumes` (BlockDevices) - Add the block device mappings to the AMI. If you add instance store
volumes or EBS volumes in addition to the root device volume, the
created AMI will contain block device mapping information for those
volumes. Amazon creates snapshots of the source instance's root volume
and any other EBS volumes described here. When you launch an instance
from this new AMI, the instance automatically launches with these
additional volumes, and will restore them from snapshots taken from the
source instance. See the [BlockDevices](#block-devices-configuration)
documentation for fields.
- `ena_support` (*bool) - Enable enhanced networking (ENA but not SriovNetSupport) on
HVM-compatible AMIs. If set, add ec2:ModifyInstanceAttribute to your AWS