aws: add validation for device_name parameter

cause it's required in block-device-mapping.

Signed-off-by: Mikhail Ushanov <gm.mephisto@gmail.com>
This commit is contained in:
Mikhail Ushanov 2018-10-12 23:01:13 +03:00
parent 50b0dd6381
commit ee133482b4
1 changed files with 4 additions and 0 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: "+