Merge pull request #4931 from hashicorp/fix4817

only delete snapshots which exist
This commit is contained in:
Matthew Hooker 2017-05-25 14:19:40 -07:00 committed by GitHub
commit c436d9aea4
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ func (s *StepDeregisterAMI) Run(state multistep.StateBag) multistep.StepAction {
// Delete snapshot(s) by image
if s.ForceDeleteSnapshot {
for _, b := range i.BlockDeviceMappings {
if b.Ebs != nil {
if b.Ebs != nil && aws.StringValue(b.Ebs.SnapshotId) != "" {
_, err := ec2conn.DeleteSnapshot(&ec2.DeleteSnapshotInput{
SnapshotId: b.Ebs.SnapshotId,
})