@@ -56,27 +56,39 @@ async function onCreate(event: CloudFormationCustomResourceEvent) {
5656
5757 if ( groupId ) {
5858 if ( securityGroupIngress && securityGroupIngress . length > 0 ) {
59- // Deleting VPC default security group inbound rule
60- await throttlingBackOff ( ( ) => ec2 . revokeSecurityGroupIngress ( buildDeleteIngressRequest ( { groupId } ) ) . promise ( ) ) ;
59+ try {
60+ // Deleting VPC default security group inbound rule
61+ await throttlingBackOff ( ( ) => ec2 . revokeSecurityGroupIngress ( buildDeleteIngressRequest ( { groupId } ) ) . promise ( ) ) ;
62+ } catch ( error : any ) {
63+ console . log ( 'Error trying to remove default security group Ingress rule' ) ;
64+ }
6165 }
6266
6367 if ( securityGroupEgress && securityGroupEgress . length > 0 ) {
64- // Deleting VPC default security group outbound rule
65- await throttlingBackOff ( ( ) => ec2 . revokeSecurityGroupEgress ( buildDeleteEgressRequest ( { groupId } ) ) . promise ( ) ) ;
68+ try {
69+ // Deleting VPC default security group outbound rule
70+ await throttlingBackOff ( ( ) => ec2 . revokeSecurityGroupEgress ( buildDeleteEgressRequest ( { groupId } ) ) . promise ( ) ) ;
71+ } catch ( error : any ) {
72+ console . log ( 'Error trying to remove default security group Egress rule' ) ;
73+ }
6674 }
6775
6876 if ( tags && tags . length === 0 ) {
69- // Attaching tags to the VPC default security group
70- await throttlingBackOff ( ( ) =>
71- ec2
72- . createTags (
73- buildCreateTagsRequest ( {
74- groupId,
75- acceleratorName : event . ResourceProperties . acceleratorName ,
76- } ) ,
77- )
78- . promise ( ) ,
79- ) ;
77+ try {
78+ // Attaching tags to the VPC default security group
79+ await throttlingBackOff ( ( ) =>
80+ ec2
81+ . createTags (
82+ buildCreateTagsRequest ( {
83+ groupId,
84+ acceleratorName : event . ResourceProperties . acceleratorName ,
85+ } ) ,
86+ )
87+ . promise ( ) ,
88+ ) ;
89+ } catch ( error : any ) {
90+ console . log ( 'Error trying to add tags to default security group' ) ;
91+ }
8092 }
8193 }
8294
0 commit comments