Commit 9805c10c authored by Clint's avatar Clint

Merge pull request #2320 from tommyulfsparre/block-device-mapping

InvalidBlockDeviceMapping
parents dd1fdc72 8ae0cfc7
...@@ -29,27 +29,27 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping { ...@@ -29,27 +29,27 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping {
for _, blockDevice := range b { for _, blockDevice := range b {
ebsBlockDevice := &ec2.EBSBlockDevice{ ebsBlockDevice := &ec2.EBSBlockDevice{
VolumeType: &blockDevice.VolumeType, VolumeType: aws.String(blockDevice.VolumeType),
VolumeSize: &blockDevice.VolumeSize, VolumeSize: aws.Long(blockDevice.VolumeSize),
DeleteOnTermination: &blockDevice.DeleteOnTermination, DeleteOnTermination: aws.Boolean(blockDevice.DeleteOnTermination),
} }
// IOPS is only valid for SSD Volumes // IOPS is only valid for SSD Volumes
if blockDevice.VolumeType != "" && blockDevice.VolumeType != "standard" && blockDevice.VolumeType != "gp2" { if blockDevice.VolumeType != "" && blockDevice.VolumeType != "standard" && blockDevice.VolumeType != "gp2" {
ebsBlockDevice.IOPS = &blockDevice.IOPS ebsBlockDevice.IOPS = aws.Long(blockDevice.IOPS)
} }
// You cannot specify Encrypted if you specify a Snapshot ID // You cannot specify Encrypted if you specify a Snapshot ID
if blockDevice.SnapshotId != "" { if blockDevice.SnapshotId != "" {
ebsBlockDevice.SnapshotID = &blockDevice.SnapshotId ebsBlockDevice.SnapshotID = aws.String(blockDevice.SnapshotId)
} else if blockDevice.Encrypted { } else if blockDevice.Encrypted {
ebsBlockDevice.Encrypted = &blockDevice.Encrypted ebsBlockDevice.Encrypted = aws.Boolean(blockDevice.Encrypted)
} }
mapping := &ec2.BlockDeviceMapping{ mapping := &ec2.BlockDeviceMapping{
EBS: ebsBlockDevice, EBS: ebsBlockDevice,
DeviceName: &blockDevice.DeviceName, DeviceName: aws.String(blockDevice.DeviceName),
VirtualName: &blockDevice.VirtualName, VirtualName: aws.String(blockDevice.VirtualName),
} }
if blockDevice.NoDevice { if blockDevice.NoDevice {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment