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
This commit is contained in:
parent
308a01795c
commit
4b1e014be8
|
@ -68,7 +68,8 @@ func (s *stepCreateAMI) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
|
|
||||||
snapshots := make(map[string][]string)
|
snapshots := make(map[string][]string)
|
||||||
for _, blockDeviceMapping := range imagesResp.Images[0].BlockDeviceMappings {
|
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)
|
snapshots[*ec2conn.Config.Region] = append(snapshots[*ec2conn.Config.Region], *blockDeviceMapping.Ebs.SnapshotId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue