Update AWS EBS builder to fix invalid params
This commit is contained in:
parent
23a48d6619
commit
999b0874cc
|
@ -29,13 +29,23 @@ func buildBlockDevices(b []BlockDevice) []*ec2.BlockDeviceMapping {
|
||||||
|
|
||||||
for _, blockDevice := range b {
|
for _, blockDevice := range b {
|
||||||
ebsBlockDevice := &ec2.EBSBlockDevice{
|
ebsBlockDevice := &ec2.EBSBlockDevice{
|
||||||
SnapshotID: &blockDevice.SnapshotId,
|
|
||||||
Encrypted: &blockDevice.Encrypted,
|
|
||||||
IOPS: &blockDevice.IOPS,
|
|
||||||
VolumeType: &blockDevice.VolumeType,
|
VolumeType: &blockDevice.VolumeType,
|
||||||
VolumeSize: &blockDevice.VolumeSize,
|
VolumeSize: &blockDevice.VolumeSize,
|
||||||
DeleteOnTermination: &blockDevice.DeleteOnTermination,
|
DeleteOnTermination: &blockDevice.DeleteOnTermination,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IOPS is only valid for SSD Volumes
|
||||||
|
if blockDevice.VolumeType != "standard" && blockDevice.VolumeType != "gp2" {
|
||||||
|
ebsBlockDevice.IOPS = &blockDevice.IOPS
|
||||||
|
}
|
||||||
|
|
||||||
|
// You cannot specify Encrypted if you specify a Snapshot ID
|
||||||
|
if blockDevice.SnapshotId != "" {
|
||||||
|
ebsBlockDevice.SnapshotID = &blockDevice.SnapshotId
|
||||||
|
} else {
|
||||||
|
ebsBlockDevice.Encrypted = &blockDevice.Encrypted
|
||||||
|
}
|
||||||
|
|
||||||
mapping := &ec2.BlockDeviceMapping{
|
mapping := &ec2.BlockDeviceMapping{
|
||||||
EBS: ebsBlockDevice,
|
EBS: ebsBlockDevice,
|
||||||
DeviceName: &blockDevice.DeviceName,
|
DeviceName: &blockDevice.DeviceName,
|
||||||
|
|
Loading…
Reference in New Issue