From f6c7e3740f9229d14b19293293010984c28c7f3e Mon Sep 17 00:00:00 2001 From: Mark Peek Date: Sun, 18 Oct 2015 11:05:21 -0700 Subject: [PATCH] Don't create EBS block device if VirtualName is specified --- builder/amazon/common/block_device.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go index 0a255fe6c..985c582ea 100644 --- a/builder/amazon/common/block_device.go +++ b/builder/amazon/common/block_device.go @@ -36,8 +36,10 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping { if blockDevice.NoDevice { mapping.NoDevice = aws.String("") - } else if strings.HasPrefix(blockDevice.VirtualName, "ephemeral") { - mapping.VirtualName = aws.String(blockDevice.VirtualName) + } else if blockDevice.VirtualName != "" { + if strings.HasPrefix(blockDevice.VirtualName, "ephemeral") { + mapping.VirtualName = aws.String(blockDevice.VirtualName) + } } else { ebsBlockDevice := &ec2.EbsBlockDevice{ DeleteOnTermination: aws.Bool(blockDevice.DeleteOnTermination),