Skip to content

Commit

Permalink
Fix removal policy on edge function
Browse files Browse the repository at this point in the history
  • Loading branch information
huntharo committed May 23, 2022
1 parent d84529a commit e150246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 1 addition & 3 deletions packages/microapps-cdk/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ Path prefix on the root of the CloudFront distribution.

### MicroAppsEdgeToOriginProps <a name="@pwrdrvr/microapps-cdk.MicroAppsEdgeToOriginProps"></a>

Properties to initialize an instance of `MicroAppsCF`.
Properties to initialize an instance of `MicroAppsEdgeToOrigin`.

#### Initializer <a name="[object Object].Initializer"></a>

Expand Down Expand Up @@ -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`<sup>Optional</sup> <a name="@pwrdrvr/microapps-cdk.MicroAppsEdgeToOriginProps.replaceHostHeader"></a>
Expand Down
9 changes: 2 additions & 7 deletions packages/microapps-cdk/src/MicroAppsEdgeToOrigin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -189,6 +187,7 @@ replaceHostHeader: ${props.replaceHostHeader}`;
// },
}),
],
...(removalPolicy ? { removalPolicy } : {}),
};
if (
process.env.NODE_ENV === 'test' ||
Expand Down Expand Up @@ -263,10 +262,6 @@ replaceHostHeader: ${props.replaceHostHeader}`;
},
...edgeToOriginFuncProps,
});

if (removalPolicy) {
this._edgeToOriginFunction.applyRemovalPolicy(removalPolicy);
}
}

this._edgeToOriginLambdas = [
Expand Down

0 comments on commit e150246

Please sign in to comment.