fix panic that occurs when ami_block_device_mappings and does not explicitly contain the root volume

This commit is contained in:
Megan Marsh 2017-06-23 14:12:31 -07:00
parent 9bc0e17e1c
commit 5f92de6a39
1 changed files with 2 additions and 1 deletions

View File

@ -25,7 +25,8 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction {
ui.Say("Registering the AMI...")
blockDevicesExcludingRoot := make([]*ec2.BlockDeviceMapping, 0, len(s.BlockDevices)-1)
// Defensive coding to make sure we only add the root volume once
blockDevicesExcludingRoot := make([]*ec2.BlockDeviceMapping, 0, len(s.BlockDevices))
for _, blockDevice := range s.BlockDevices {
if *blockDevice.DeviceName == s.RootDevice.SourceDeviceName {
continue