Commit 33b4f5cc authored by James Nugent's avatar James Nugent

Check for EBS being nil before assigning it

parent e99cd56b
...@@ -25,7 +25,11 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction { ...@@ -25,7 +25,11 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction {
for i, device := range image.BlockDeviceMappings { for i, device := range image.BlockDeviceMappings {
newDevice := device newDevice := device
if newDevice.DeviceName == image.RootDeviceName { 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 blockDevices[i] = newDevice
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment