From 4b1e014be8b65cb5c1a502c1c69b65bc3ad3a8d9 Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Wed, 21 Dec 2016 15:37:08 +0100 Subject: [PATCH] builder/amazon: Crashes when multiple EBS vols are used If you use a new EBS vol (which hasn't any snapshot) Packer crashes when creating the AMI. Closes #4303 --- builder/amazon/ebs/step_create_ami.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/amazon/ebs/step_create_ami.go b/builder/amazon/ebs/step_create_ami.go index b484e0692..d78922b98 100644 --- a/builder/amazon/ebs/step_create_ami.go +++ b/builder/amazon/ebs/step_create_ami.go @@ -68,7 +68,8 @@ func (s *stepCreateAMI) Run(state multistep.StateBag) multistep.StepAction { snapshots := make(map[string][]string) for _, blockDeviceMapping := range imagesResp.Images[0].BlockDeviceMappings { - if blockDeviceMapping.Ebs != nil { + if blockDeviceMapping.Ebs != nil && blockDeviceMapping.Ebs.SnapshotId != nil { + snapshots[*ec2conn.Config.Region] = append(snapshots[*ec2conn.Config.Region], *blockDeviceMapping.Ebs.SnapshotId) } }