aws: Ignore volumes set to delete on instance termination

This commit is contained in:
Ciprian Hacman 2023-08-14 18:42:03 +03:00
parent 21c0a89676
commit 8a2f74ce46
1 changed files with 11 additions and 0 deletions

View File

@ -561,6 +561,17 @@ func ListVolumes(cloud fi.Cloud, clusterName string) ([]*resources.Resource, err
for _, volume := range volumes {
id := aws.StringValue(volume.VolumeId)
deleteOnTermination := false
for _, attachment := range volume.Attachments {
if aws.BoolValue(attachment.DeleteOnTermination) {
deleteOnTermination = true
break
}
}
if deleteOnTermination {
continue
}
resourceTracker := &resources.Resource{
Name: FindName(volume.Tags),
ID: id,