Make EBS block device mapping optional for ephemeral virtual names.
This commit is contained in:
parent
f27505626f
commit
224bb78175
|
@ -4,6 +4,7 @@ import (
|
|||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/mitchellh/packer/template/interpolate"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BlockDevice
|
||||
|
@ -47,11 +48,14 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping {
|
|||
}
|
||||
|
||||
mapping := &ec2.BlockDeviceMapping{
|
||||
EBS: ebsBlockDevice,
|
||||
DeviceName: aws.String(blockDevice.DeviceName),
|
||||
VirtualName: aws.String(blockDevice.VirtualName),
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(blockDevice.VirtualName, "ephemeral") {
|
||||
mapping.EBS = ebsBlockDevice
|
||||
}
|
||||
|
||||
if blockDevice.NoDevice {
|
||||
mapping.NoDevice = aws.String("")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue