From d4b6a614459a25455b3a0574e991f9ea4f53c671 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Mon, 1 Jul 2019 14:44:17 -0700 Subject: [PATCH] don't store names of volumes we will be deleting when the instance terminates --- builder/amazon/ebsvolume/step_tag_ebs_volumes.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builder/amazon/ebsvolume/step_tag_ebs_volumes.go b/builder/amazon/ebsvolume/step_tag_ebs_volumes.go index eee1882b6..e58cb98de 100644 --- a/builder/amazon/ebsvolume/step_tag_ebs_volumes.go +++ b/builder/amazon/ebsvolume/step_tag_ebs_volumes.go @@ -24,6 +24,9 @@ func (s *stepTagEBSVolumes) Run(ctx context.Context, state multistep.StateBag) m for _, instanceBlockDevices := range instance.BlockDeviceMappings { for _, configVolumeMapping := range s.VolumeMapping { if configVolumeMapping.DeviceName == *instanceBlockDevices.DeviceName { + if configVolumeMapping.DeleteOnTermination { + continue + } volumes[*ec2conn.Config.Region] = append( volumes[*ec2conn.Config.Region], *instanceBlockDevices.Ebs.VolumeId)