Merge pull request #6845 from gmmephisto/pr-master-device-name

aws: add validation for device_name parameter
This commit is contained in:
Adrien Delorme 2018-10-17 15:32:10 +02:00 committed by GitHub
commit 10d328906f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 7 deletions

View File

@ -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: "+

View File

@ -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
@ -194,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,

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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