From 8cea5d409a558bf2dfb218007a3a16e63c776fea Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Wed, 19 Jun 2019 11:50:40 +0200 Subject: [PATCH] doc ebsvolume builder using partials --- builder/amazon/ebsvolume/block_device.go | 12 ---- builder/amazon/ebsvolume/builder.go | 11 +++- .../builders/amazon-ebsvolume.html.md.erb | 59 ++++++++++++++----- .../_BlockDevice-not-required.html.md | 1 - .../ebsvolume/_Config-not-required.html.md | 11 +++- 5 files changed, 63 insertions(+), 31 deletions(-) diff --git a/builder/amazon/ebsvolume/block_device.go b/builder/amazon/ebsvolume/block_device.go index f9eafa122..136252ac4 100644 --- a/builder/amazon/ebsvolume/block_device.go +++ b/builder/amazon/ebsvolume/block_device.go @@ -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 -} diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index ad1b26289..808c7c3ce 100644 --- a/builder/amazon/ebsvolume/builder.go +++ b/builder/amazon/ebsvolume/builder.go @@ -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 diff --git a/website/source/docs/builders/amazon-ebsvolume.html.md.erb b/website/source/docs/builders/amazon-ebsvolume.html.md.erb index 7be033790..ff0f31370 100644 --- a/website/source/docs/builders/amazon-ebsvolume.html.md.erb +++ b/website/source/docs/builders/amazon-ebsvolume.html.md.erb @@ -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 diff --git a/website/source/partials/builder/amazon/ebsvolume/_BlockDevice-not-required.html.md b/website/source/partials/builder/amazon/ebsvolume/_BlockDevice-not-required.html.md index 4d7e40a97..c27a24348 100644 --- a/website/source/partials/builder/amazon/ebsvolume/_BlockDevice-not-required.html.md +++ b/website/source/partials/builder/amazon/ebsvolume/_BlockDevice-not-required.html.md @@ -1,6 +1,5 @@ -- `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. diff --git a/website/source/partials/builder/amazon/ebsvolume/_Config-not-required.html.md b/website/source/partials/builder/amazon/ebsvolume/_Config-not-required.html.md index 3582c5d28..42e20bf6d 100644 --- a/website/source/partials/builder/amazon/ebsvolume/_Config-not-required.html.md +++ b/website/source/partials/builder/amazon/ebsvolume/_Config-not-required.html.md @@ -1,7 +1,14 @@ -- `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