Merge pull request #6845 from gmmephisto/pr-master-device-name
aws: add validation for device_name parameter
This commit is contained in:
commit
10d328906f
|
@ -88,6 +88,10 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BlockDevice) Prepare(ctx *interpolate.Context) error {
|
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
|
// Warn that encrypted must be true when setting kms_key_id
|
||||||
if b.KmsKeyId != "" && b.Encrypted == false {
|
if b.KmsKeyId != "" && b.Encrypted == false {
|
||||||
return fmt.Errorf("The device %v, must also have `encrypted: "+
|
return fmt.Errorf("The device %v, must also have `encrypted: "+
|
||||||
|
|
|
@ -169,7 +169,8 @@ each category, the available configuration keys are alphabetized.
|
||||||
every build.
|
every build.
|
||||||
|
|
||||||
- `device_name` (string) - The device name exposed to the instance (for
|
- `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
|
- `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
|
- `volume_size` (number) - The size of the volume, in GiB. Required if not
|
||||||
specifying a `snapshot_id`
|
specifying a `snapshot_id`
|
||||||
|
|
||||||
- `volume_type` (string) - The volume type. gp2 for General Purpose (SSD)
|
- `volume_type` (string) - The volume type. `gp2` for General Purpose (SSD)
|
||||||
volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic
|
volumes, `io1` for Provisioned IOPS (SSD) volumes, and `standard` for Magnetic
|
||||||
volumes
|
volumes
|
||||||
|
|
||||||
- `region_kms_key_ids` (map of strings) - a map of regions to copy the ami to,
|
- `region_kms_key_ids` (map of strings) - a map of regions to copy the ami to,
|
||||||
|
|
|
@ -83,7 +83,8 @@ builder.
|
||||||
every build.
|
every build.
|
||||||
|
|
||||||
- `device_name` (string) - The device name exposed to the instance (for
|
- `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
|
- `encrypted` (boolean) - Indicates whether to encrypt the volume or not
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ builder.
|
||||||
every build.
|
every build.
|
||||||
|
|
||||||
- `device_name` (string) - The device name exposed to the instance (for
|
- `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
|
- `encrypted` (boolean) - Indicates whether to encrypt the volume or not
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,8 @@ builder.
|
||||||
device mappings to the AMI. The block device mappings allow for keys:
|
device mappings to the AMI. The block device mappings allow for keys:
|
||||||
|
|
||||||
- `device_name` (string) - The device name exposed to the instance (for
|
- `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
|
- `delete_on_termination` (boolean) - Indicates whether the EBS volume is
|
||||||
deleted on instance termination.
|
deleted on instance termination.
|
||||||
|
|
|
@ -105,7 +105,8 @@ builder.
|
||||||
every build.
|
every build.
|
||||||
|
|
||||||
- `device_name` (string) - The device name exposed to the instance (for
|
- `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
|
- `encrypted` (boolean) - Indicates whether to encrypt the volume or not
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue