From 5d600c70f2356c7b5d8a06eb363e9c05ea824a77 Mon Sep 17 00:00:00 2001 From: Jan Schumann Date: Wed, 10 Jun 2015 17:20:41 +0200 Subject: [PATCH 1/2] added test to illustrate wrong behavior --- builder/amazon/common/block_device_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/builder/amazon/common/block_device_test.go b/builder/amazon/common/block_device_test.go index aacd54cb4..12d1530bf 100644 --- a/builder/amazon/common/block_device_test.go +++ b/builder/amazon/common/block_device_test.go @@ -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{ DeviceName: "/dev/sdb", From 802cfa38715bd12851f2e8719c5165338c78f6ed Mon Sep 17 00:00:00 2001 From: Jan Schumann Date: Wed, 10 Jun 2015 17:21:25 +0200 Subject: [PATCH 2/2] make sure IOPS is not set for empty VolumeType --- builder/amazon/common/block_device.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go index c44d03561..e97cd4107 100644 --- a/builder/amazon/common/block_device.go +++ b/builder/amazon/common/block_device.go @@ -35,7 +35,7 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping { } // 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 }