@@ -102,30 +102,46 @@ export async function snapshotKmsKeys(
102102 nextToken = results . NextMarker ;
103103 if ( results . Keys ) {
104104 for ( const key of results . Keys ) {
105- const keyResults = await describeKmsKey ( key . KeyId ! , region , credentials ) ;
106- await snapshotTable . writeResource ( {
107- accountId : accountId ,
108- region : region ,
109- resourceName : `kms-key-${ key . KeyId } ` ,
110- preMigration : preMigration ,
111- data : keyResults ,
112- } ) ;
113- const keyGrantResults = await getKmsKeyGrants ( key . KeyId ! , region , credentials ) ;
114- await snapshotTable . writeResource ( {
115- accountId : accountId ,
116- region : region ,
117- resourceName : `kms-key-grant-${ key . KeyId } ` ,
118- preMigration : preMigration ,
119- data : keyGrantResults ,
120- } ) ;
121- const keyPolicyResults = await getKmsKeyPolicy ( key . KeyId ! , region , credentials ) ;
122- await snapshotTable . writeResource ( {
123- accountId : accountId ,
124- region : region ,
125- resourceName : `kms-key-policy-${ key . KeyId } ` ,
126- preMigration : preMigration ,
127- data : keyPolicyResults ,
128- } ) ;
105+ try {
106+ const keyResults = await describeKmsKey ( key . KeyId ! , region , credentials ) ;
107+
108+ await snapshotTable . writeResource ( {
109+ accountId : accountId ,
110+ region : region ,
111+ resourceName : `kms-key-${ key . KeyId } ` ,
112+ preMigration : preMigration ,
113+ data : keyResults ,
114+ } ) ;
115+ } catch ( e ) {
116+ console . log ( `Error with key ${ key . KeyId } in region ${ region } ` ) ;
117+ console . log ( e ) ;
118+ }
119+ try {
120+ const keyGrantResults = await getKmsKeyGrants ( key . KeyId ! , region , credentials ) ;
121+ await snapshotTable . writeResource ( {
122+ accountId : accountId ,
123+ region : region ,
124+ resourceName : `kms-key-grant-${ key . KeyId } ` ,
125+ preMigration : preMigration ,
126+ data : keyGrantResults ,
127+ } ) ;
128+ } catch ( e ) {
129+ console . log ( `Error with key ${ key . KeyId } in region ${ region } ` ) ;
130+ console . log ( e ) ;
131+ }
132+ try {
133+ const keyPolicyResults = await getKmsKeyPolicy ( key . KeyId ! , region , credentials ) ;
134+ await snapshotTable . writeResource ( {
135+ accountId : accountId ,
136+ region : region ,
137+ resourceName : `kms-key-policy-${ key . KeyId } ` ,
138+ preMigration : preMigration ,
139+ data : keyPolicyResults ,
140+ } ) ;
141+ } catch ( e ) {
142+ console . log ( `Error with key ${ key . KeyId } in region ${ region } ` ) ;
143+ console . log ( e ) ;
144+ }
129145 }
130146 }
131147 } while ( nextToken ) ;
0 commit comments