mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-20 15:01:40 -04:00
Check for EBS being nil before assigning it
This commit is contained in:
@@ -25,7 +25,11 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction {
|
||||
for i, device := range image.BlockDeviceMappings {
|
||||
newDevice := device
|
||||
if newDevice.DeviceName == image.RootDeviceName {
|
||||
newDevice.EBS.SnapshotID = &snapshotId
|
||||
if newDevice.EBS != nil {
|
||||
newDevice.EBS.SnapshotID = &snapshotId
|
||||
} else {
|
||||
newDevice.EBS = &ec2.EBSBlockDevice{SnapshotID: &snapshotId}
|
||||
}
|
||||
}
|
||||
|
||||
blockDevices[i] = newDevice
|
||||
|
||||
Reference in New Issue
Block a user