diff --git a/cmd/osbuild-service-maintenance/aws.go b/cmd/osbuild-service-maintenance/aws.go index 8b8b8384b3..daecaa9dfd 100644 --- a/cmd/osbuild-service-maintenance/aws.go +++ b/cmd/osbuild-service-maintenance/aws.go @@ -158,9 +158,11 @@ func terminateOrphanedSecureInstances(a *awscloud.AWS, dryRun bool) error { instanceIDs = filterOnTooOld(instanceIDs, reservations) logrus.Infof("Cleaning up executor instances: %v", instanceIDs) if !dryRun { - err = a.TerminateInstances(instanceIDs) - if err != nil { - return fmt.Errorf("Unable to terminate secure instances: %w", err) + if len(instanceIDs) > 0 { + err = a.TerminateInstances(instanceIDs) + if err != nil { + return fmt.Errorf("Unable to terminate secure instances: %w", err) + } } } else { logrus.Info("Dry run, didn't actually terminate any instances")