From e150246932909bdba27f9712f7b4e6b268305207 Mon Sep 17 00:00:00 2001 From: Harold Hunt Date: Mon, 23 May 2022 14:54:30 -0400 Subject: [PATCH] Fix removal policy on edge function --- packages/microapps-cdk/API.md | 4 +--- packages/microapps-cdk/src/MicroAppsEdgeToOrigin.ts | 9 ++------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/microapps-cdk/API.md b/packages/microapps-cdk/API.md index 802db7dc..7a819e62 100644 --- a/packages/microapps-cdk/API.md +++ b/packages/microapps-cdk/API.md @@ -885,7 +885,7 @@ Path prefix on the root of the CloudFront distribution. ### MicroAppsEdgeToOriginProps -Properties to initialize an instance of `MicroAppsCF`. +Properties to initialize an instance of `MicroAppsEdgeToOrigin`. #### Initializer @@ -943,8 +943,6 @@ Origin region that API Gateway will be deployed to, used for the config.yml on t RemovalPolicy override for child resources. -Note: if set to DESTROY the S3 buckes will have `autoDeleteObjects` set to `true` - --- ##### `replaceHostHeader`Optional diff --git a/packages/microapps-cdk/src/MicroAppsEdgeToOrigin.ts b/packages/microapps-cdk/src/MicroAppsEdgeToOrigin.ts index 439daddb..cd1f3486 100644 --- a/packages/microapps-cdk/src/MicroAppsEdgeToOrigin.ts +++ b/packages/microapps-cdk/src/MicroAppsEdgeToOrigin.ts @@ -27,14 +27,12 @@ export interface IMicroAppsEdgeToOrigin { } /** - * Properties to initialize an instance of `MicroAppsCF`. + * Properties to initialize an instance of `MicroAppsEdgeToOrigin`. */ export interface MicroAppsEdgeToOriginProps { /** * RemovalPolicy override for child resources * - * Note: if set to DESTROY the S3 buckes will have `autoDeleteObjects` set to `true` - * * @default - per resource default */ readonly removalPolicy?: RemovalPolicy; @@ -189,6 +187,7 @@ replaceHostHeader: ${props.replaceHostHeader}`; // }, }), ], + ...(removalPolicy ? { removalPolicy } : {}), }; if ( process.env.NODE_ENV === 'test' || @@ -263,10 +262,6 @@ replaceHostHeader: ${props.replaceHostHeader}`; }, ...edgeToOriginFuncProps, }); - - if (removalPolicy) { - this._edgeToOriginFunction.applyRemovalPolicy(removalPolicy); - } } this._edgeToOriginLambdas = [