Skip to content

Commit f1edd10

Browse files
committed
fix: unwanted behaivour when byResource is not specified
1 parent bb74863 commit f1edd10

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/index.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,13 @@ export class SelfDestructAspect implements IAspect {
278278
const att = node.getAtt('DeletionPolicy')
279279
if (
280280
att.displayName === 'DeletionPolicy' &&
281-
this.settings.byResource?.resourcesToRetain?.includes(
282-
node.cfnResourceType
283-
) === false &&
284281
shouldDestroy(
285-
this.settings.byResource?.resourcesToDestroy?.includes(
286-
node.cfnResourceType
287-
) === true
288-
? true
289-
: undefined,
290-
this.settings.defaultBehavior.destoryAllResources
282+
undefined,
283+
this.settings.defaultBehavior.destoryAllResources,
284+
{
285+
byResource: this.settings.byResource,
286+
resourceName: node.cfnResourceType,
287+
}
291288
) &&
292289
node.cfnResourceType !== 'AWS::S3::Bucket'
293290
) {

0 commit comments

Comments
 (0)