diff --git a/pkg/aws/cleaner.go b/pkg/aws/cleaner.go index bc9c8c6..e3839fe 100644 --- a/pkg/aws/cleaner.go +++ b/pkg/aws/cleaner.go @@ -55,119 +55,132 @@ func DeleteResources(ctx context.Context, accounts []dto.Account, tries int, ret func deleteVpcAndEks(ctx context.Context, clients *clients, vpcID, clusterName string) error { logger := log.FromContext(ctx) var errs error - logger.Info("deleting vpc peering connections") + logger.Info("listing vpc peering connections") connections, err := listVpcPeeringConnections(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting vpc peering connections: %d", len(connections)) if err := deleteVpcPeeringConnections(ctx, clients.EC2, vpcID, connections); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting load balancers") + logger.Info("listing load balancers") balancers, err := listLoadBalancers(ctx, clients.ELB, vpcID) if err != nil { return err } + logger.Infof("deleting load balancers: %d", len(balancers)) if err := deleteLoadBalancers(ctx, clients.ELB, balancers); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting autoscaling groups") + logger.Info("listing autoscaling groups") scalingGroups, err := listAutoScalingGroups(ctx, clients.ASG, clusterName) if err != nil { return err } + logger.Infof("deleting autoscaling groups: %d", len(scalingGroups)) if err := deleteAutoScalingGroups(ctx, clients.ASG, clients.EC2, scalingGroups); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting reservation") + logger.Info("listing reservation") reservations, err := listReservations(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting reservation: %d", len(reservations)) if err := terminateInstancesInReservations(ctx, clients.EC2, reservations); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting network acl") + logger.Info("listing network acl") acls, err := listNonDefaultNetworkAcls(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting network acl: %d", len(acls)) if err := deleteNetworkAcls(ctx, clients.EC2, vpcID, acls); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting elastic ips") + logger.Info("listing elastic ips") ips, err := listElasticIps(ctx, clients.EC2, clusterName) if err != nil { return err } + logger.Infof("deleting elastic ips: %d", len(ips)) if err := releaseElasticIps(ctx, clients.EC2, ips); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting nat gateways") + logger.Info("listing nat gateways") nats, err := listNatGateways(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting nat gateways: %d", len(nats)) if err := deleteNatGateways(ctx, clients.EC2, nats); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting internet gateways") + logger.Info("listing internet gateways") gws, err := listInternetGateways(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting internet gateways: %d", len(gws)) if err := deleteInternetGateways(ctx, clients.EC2, vpcID, gws); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting network interfaces") + logger.Info("listing network interfaces") interfaces, err := listNetworkInterfaces(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting network interfaces: %d", len(interfaces)) if err := deleteNetworkInterfaces(ctx, clients.EC2, interfaces); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting subnets") + logger.Info("listing subnets") subnets, err := listSubnets(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting subnets: %d", len(subnets)) if err := deleteSubnets(ctx, clients.EC2, vpcID, subnets); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting security groups") + logger.Info("listing security groups") secGroups, err := listNonDefaultSecurityGroups(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting security groups: %d", len(secGroups)) if err := deleteSecurityGroups(ctx, clients.EC2, vpcID, secGroups); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting vpn gateways") + logger.Info("listing vpn gateways") vpns, err := listVpnGateways(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting vpn gateways: %d", len(vpns)) if err := deleteVpnGateways(ctx, clients.EC2, vpcID, vpns); err != nil { errs = multierr.Append(errs, err) } - logger.Info("deleting route tables") + logger.Info("listing route tables") routes, err := listRouteTables(ctx, clients.EC2, vpcID) if err != nil { return err } + logger.Infof("deleting route tables: %d", len(routes)) if err := deleteRouteTables(ctx, clients.EC2, vpcID, routes); err != nil { errs = multierr.Append(errs, err) }