@@ -660,27 +660,27 @@ const generateReport = (jobs: _.Dictionary<ReportEntry>, accountIdx: number): vo
660660const deleteResources = async (
661661 account : AWSAccountInfo ,
662662 accountIndex : number ,
663- staleResources : Record < string , ReportEntry > ,
663+ stacks : StackInfo [ ] ,
664664) : Promise < void > => {
665- for ( const jobId of Object . keys ( staleResources ) ) {
666- const resources = staleResources [ jobId ] ;
667- if ( resources . amplifyApps ) {
668- await deleteAmplifyApps ( account , accountIndex , Object . values ( resources . amplifyApps ) ) ;
669- }
670-
671- if ( resources . stacks ) {
672- await deleteCfnStacks ( account , accountIndex , Object . values ( resources . stacks ) ) ;
665+ // for (const jobId of Object.keys(staleResources)) {
666+ // const resources = staleResources[jobId];
667+ // if (resources.amplifyApps) {
668+ // await deleteAmplifyApps(account, accountIndex, Object.values(resources.amplifyApps));
669+ // }
670+
671+ if ( stacks ) {
672+ await deleteCfnStacks ( account , accountIndex , stacks ) ;
673673 }
674674
675675 // if (resources.buckets) {
676676 // await deleteBuckets(account, accountIndex, Object.values(resources.buckets));
677677 // }
678678
679- if ( resources . roles ) {
680- await deleteIamRoles ( account , accountIndex , Object . values ( resources . roles ) ) ;
681- }
682- }
683- } ;
679+ // if (resources.roles) {
680+ // await deleteIamRoles(account, accountIndex, Object.values(resources.roles));
681+ // }
682+ } ;
683+ // };
684684
685685/**
686686 * Grab the right CI filter based on args passed in.
@@ -785,17 +785,16 @@ const cleanupAccount = async (account: AWSAccountInfo, accountIndex: number, fil
785785
786786 const apps = ( await Promise . all ( appPromises ) ) . flat ( ) ;
787787 const stacks = ( await Promise . all ( stackPromises ) ) . flat ( ) ;
788+ console . log ( stacks ) ;
788789 const buckets = await bucketPromise ;
789790 const orphanBuckets = await orphanBucketPromise ;
790791 const orphanIamRoles = await orphanIamRolesPromise ;
791792
792793 const allResources = await mergeResourcesByCCIJob ( apps , stacks , buckets , orphanBuckets , orphanIamRoles ) ;
793- console . log ( "all: " , allResources ) ;
794794 const staleResources = _ . pickBy ( allResources , filterPredicate ) ;
795- console . log ( "stale: " , staleResources ) ;
796795
797796 generateReport ( staleResources , accountIndex ) ;
798- await deleteResources ( account , accountIndex , staleResources ) ;
797+ await deleteResources ( account , accountIndex , stacks ) ;
799798 console . log ( `${ generateAccountInfo ( account , accountIndex ) } Cleanup done!` ) ;
800799} ;
801800
0 commit comments