Merge pull request #2201 from janschumann/ebs_volume_creation_fails_without_volume_type

EBS volume creation fails without volume type
This commit is contained in:
Clint 2015-06-10 10:46:21 -05:00
commit 5c8d973563
2 changed files with 18 additions and 1 deletions

View File

@ -35,7 +35,7 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping {
} }
// IOPS is only valid for SSD Volumes // IOPS is only valid for SSD Volumes
if blockDevice.VolumeType != "standard" && blockDevice.VolumeType != "gp2" { if blockDevice.VolumeType != "" && blockDevice.VolumeType != "standard" && blockDevice.VolumeType != "gp2" {
ebsBlockDevice.IOPS = &blockDevice.IOPS ebsBlockDevice.IOPS = &blockDevice.IOPS
} }

View File

@ -36,6 +36,23 @@ func TestBlockDevice(t *testing.T) {
}, },
}, },
}, },
{
Config: &BlockDevice{
DeviceName: "/dev/sdb",
VolumeSize: 8,
},
Result: &ec2.BlockDeviceMapping{
DeviceName: aws.String("/dev/sdb"),
VirtualName: aws.String(""),
EBS: &ec2.EBSBlockDevice{
Encrypted: aws.Boolean(false),
VolumeType: aws.String(""),
VolumeSize: aws.Long(8),
DeleteOnTermination: aws.Boolean(false),
},
},
},
{ {
Config: &BlockDevice{ Config: &BlockDevice{
DeviceName: "/dev/sdb", DeviceName: "/dev/sdb",