From ee133482b43fd31439e6074e83e94b9d37977f14 Mon Sep 17 00:00:00 2001 From: Mikhail Ushanov Date: Fri, 12 Oct 2018 23:01:13 +0300 Subject: [PATCH 1/3] aws: add validation for device_name parameter cause it's required in block-device-mapping. Signed-off-by: Mikhail Ushanov --- builder/amazon/common/block_device.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go index c88e1cbb5..30e50553f 100644 --- a/builder/amazon/common/block_device.go +++ b/builder/amazon/common/block_device.go @@ -88,6 +88,10 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping { } func (b *BlockDevice) Prepare(ctx *interpolate.Context) error { + if b.DeviceName == "" { + return fmt.Errorf("The `device_name` must be specified " + + "for every device in the block device mapping.") + } // Warn that encrypted must be true when setting kms_key_id if b.KmsKeyId != "" && b.Encrypted == false { return fmt.Errorf("The device %v, must also have `encrypted: "+ From e8e0810f14e576820002dbab2e8623079de86610 Mon Sep 17 00:00:00 2001 From: Mikhail Ushanov Date: Fri, 12 Oct 2018 23:04:47 +0300 Subject: [PATCH 2/3] website: update device_name parameter description Signed-off-by: Mikhail Ushanov --- website/source/docs/builders/amazon-chroot.html.md | 3 ++- website/source/docs/builders/amazon-ebs.html.md | 3 ++- website/source/docs/builders/amazon-ebssurrogate.html.md | 3 ++- website/source/docs/builders/amazon-ebsvolume.html.md | 3 ++- website/source/docs/builders/amazon-instance.html.md | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/website/source/docs/builders/amazon-chroot.html.md b/website/source/docs/builders/amazon-chroot.html.md index 8f84b49b6..650a2299b 100644 --- a/website/source/docs/builders/amazon-chroot.html.md +++ b/website/source/docs/builders/amazon-chroot.html.md @@ -169,7 +169,8 @@ each category, the available configuration keys are alphabetized. every build. - `device_name` (string) - The device name exposed to the instance (for - example, `/dev/sdh` or `xvdh`). Required when specifying `volume_size`. + example, `/dev/sdh` or `xvdh`). Required for every device in the + block device mapping. - `encrypted` (boolean) - Indicates whether to encrypt the volume or not diff --git a/website/source/docs/builders/amazon-ebs.html.md b/website/source/docs/builders/amazon-ebs.html.md index 8217fc714..d54bd7dfd 100644 --- a/website/source/docs/builders/amazon-ebs.html.md +++ b/website/source/docs/builders/amazon-ebs.html.md @@ -83,7 +83,8 @@ builder. every build. - `device_name` (string) - The device name exposed to the instance (for - example, `/dev/sdh` or `xvdh`). Required when specifying `volume_size`. + example, `/dev/sdh` or `xvdh`). Required for every device in the + block device mapping. - `encrypted` (boolean) - Indicates whether to encrypt the volume or not diff --git a/website/source/docs/builders/amazon-ebssurrogate.html.md b/website/source/docs/builders/amazon-ebssurrogate.html.md index d592b9805..a60609326 100644 --- a/website/source/docs/builders/amazon-ebssurrogate.html.md +++ b/website/source/docs/builders/amazon-ebssurrogate.html.md @@ -76,7 +76,8 @@ builder. every build. - `device_name` (string) - The device name exposed to the instance (for - example, `/dev/sdh` or `xvdh`). Required when specifying `volume_size`. + example, `/dev/sdh` or `xvdh`). Required for every device in the + block device mapping. - `encrypted` (boolean) - Indicates whether to encrypt the volume or not diff --git a/website/source/docs/builders/amazon-ebsvolume.html.md b/website/source/docs/builders/amazon-ebsvolume.html.md index 7309ff6c5..a52304529 100644 --- a/website/source/docs/builders/amazon-ebsvolume.html.md +++ b/website/source/docs/builders/amazon-ebsvolume.html.md @@ -63,7 +63,8 @@ builder. device mappings to the AMI. The block device mappings allow for keys: - `device_name` (string) - The device name exposed to the instance (for - example, `/dev/sdh` or `xvdh`). Required when specifying `volume_size`. + example, `/dev/sdh` or `xvdh`). Required for every device in the + block device mapping. - `delete_on_termination` (boolean) - Indicates whether the EBS volume is deleted on instance termination. diff --git a/website/source/docs/builders/amazon-instance.html.md b/website/source/docs/builders/amazon-instance.html.md index 412e2e703..ee6f31195 100644 --- a/website/source/docs/builders/amazon-instance.html.md +++ b/website/source/docs/builders/amazon-instance.html.md @@ -105,7 +105,8 @@ builder. every build. - `device_name` (string) - The device name exposed to the instance (for - example, `/dev/sdh` or `xvdh`). Required when specifying `volume_size`. + example, `/dev/sdh` or `xvdh`). Required for every device in the + block device mapping. - `encrypted` (boolean) - Indicates whether to encrypt the volume or not From a01eb656adb43a389de46b4e2fda37b65c7e7b32 Mon Sep 17 00:00:00 2001 From: Mikhail Ushanov Date: Fri, 12 Oct 2018 23:06:13 +0300 Subject: [PATCH 3/3] website: fix volume_type names formatting for consistent docs pages Signed-off-by: Mikhail Ushanov --- website/source/docs/builders/amazon-chroot.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/source/docs/builders/amazon-chroot.html.md b/website/source/docs/builders/amazon-chroot.html.md index 650a2299b..9bd5be7b1 100644 --- a/website/source/docs/builders/amazon-chroot.html.md +++ b/website/source/docs/builders/amazon-chroot.html.md @@ -195,8 +195,8 @@ each category, the available configuration keys are alphabetized. - `volume_size` (number) - The size of the volume, in GiB. Required if not specifying a `snapshot_id` - - `volume_type` (string) - The volume type. gp2 for General Purpose (SSD) - volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic + - `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD) + volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic volumes - `region_kms_key_ids` (map of strings) - a map of regions to copy the ami to,