Skip to content

Commit

Permalink
fix: unwanted behaivour when byResource is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
NimmLor committed Jun 14, 2023
1 parent bb74863 commit f1edd10
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,13 @@ export class SelfDestructAspect implements IAspect {
const att = node.getAtt('DeletionPolicy')
if (
att.displayName === 'DeletionPolicy' &&
this.settings.byResource?.resourcesToRetain?.includes(
node.cfnResourceType
) === false &&
shouldDestroy(
this.settings.byResource?.resourcesToDestroy?.includes(
node.cfnResourceType
) === true
? true
: undefined,
this.settings.defaultBehavior.destoryAllResources
undefined,
this.settings.defaultBehavior.destoryAllResources,
{
byResource: this.settings.byResource,
resourceName: node.cfnResourceType,
}
) &&
node.cfnResourceType !== 'AWS::S3::Bucket'
) {
Expand Down

0 comments on commit f1edd10

Please sign in to comment.