builder/amazon: Add io2 as a supported volume type

io2 volumes are new as of 2020-08-24. This adds support for specifying
them in a packer template and having the iops value specified take
effect.
pull/10102/head
Matt Rogers 6 years ago
parent c7ba5c9a14
commit 15f97421e2
No known key found for this signature in database
GPG Key ID: 6BAA7911427E1F68

@ -134,8 +134,8 @@ func (blockDevice BlockDevice) BuildEC2BlockDeviceMapping() *ec2.BlockDeviceMapp
ebsBlockDevice.VolumeSize = aws.Int64(blockDevice.VolumeSize)
}
// IOPS is only valid for io1 type
if blockDevice.VolumeType == "io1" {
// IOPS is only valid for io1 and io2 types
if blockDevice.VolumeType == "io1" || blockDevice.VolumeType == "io2" {
ebsBlockDevice.Iops = aws.Int64(blockDevice.IOPS)
}

@ -66,6 +66,25 @@ func TestBlockDevice(t *testing.T) {
},
},
},
{
Config: &BlockDevice{
DeviceName: "/dev/sdb",
VolumeType: "io2",
VolumeSize: 8,
DeleteOnTermination: true,
IOPS: 1000,
},
Result: &ec2.BlockDeviceMapping{
DeviceName: aws.String("/dev/sdb"),
Ebs: &ec2.EbsBlockDevice{
VolumeType: aws.String("io2"),
VolumeSize: aws.Int64(8),
DeleteOnTermination: aws.Bool(true),
Iops: aws.Int64(1000),
},
},
},
{
Config: &BlockDevice{
DeviceName: "/dev/sdb",

Loading…
Cancel
Save