don't store names of volumes we will be deleting when the instance terminates

This commit is contained in:
Megan Marsh 2019-07-01 14:44:17 -07:00
parent 0e59154458
commit d4b6a61445
1 changed files with 3 additions and 0 deletions

View File

@ -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)