mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-25 10:59:43 -05:00
Check for EBS being nil before assigning it
This commit is contained in:
parent
e99cd56b6c
commit
33b4f5cc0a
1 changed files with 5 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue