Skip to content

Commit b5a24d1

Browse files
committed
Fixes
1 parent a852496 commit b5a24d1

File tree

3 files changed

+2
-29
lines changed

3 files changed

+2
-29
lines changed

src/function/PhpFpmFunction.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Function, FunctionProps, Runtime } from 'aws-cdk-lib/aws-lambda';
22
import { Duration, Stack } from 'aws-cdk-lib';
33
import { Construct } from 'constructs';
4-
import { functionDefaults, vpcDefaults } from './defaults';
4+
import { functionDefaults } from './defaults';
55
import { phpLayer } from '../layers';
66
import { packagePhpCode } from '../package';
77

@@ -26,7 +26,6 @@ export class PhpFpmFunction extends Function {
2626

2727
super(scope, id, {
2828
...defaults,
29-
...vpcDefaults(props.vpc),
3029
// Provided props override defaults
3130
...props,
3231
// But we force the layers to an empty array because we define them below

src/function/PhpFunction.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import { Function, FunctionProps, Runtime } from 'aws-cdk-lib/aws-lambda';
22
import { Duration, Stack } from 'aws-cdk-lib';
33
import { Construct } from 'constructs';
4-
import { functionDefaults, vpcDefaults } from './defaults';
4+
import { functionDefaults } from './defaults';
55
import { phpLayer } from '../layers';
66
import { packagePhpCode } from '../package';
7-
import { IVpc } from 'aws-cdk-lib/aws-ec2';
8-
import { VpcForServerlessApp } from '../vpc/VpcForServerlessApp';
97

108
export type PhpFunctionProps = Partial<FunctionProps> & {
119
phpVersion?: '8.2' | '8.3' | '8.4' | '8.5';
1210
handler: string;
13-
vpc?: IVpc | VpcForServerlessApp;
1411
};
1512

1613
export class PhpFunction extends Function {
@@ -27,7 +24,6 @@ export class PhpFunction extends Function {
2724

2825
super(scope, id, {
2926
...defaults,
30-
...vpcDefaults(props.vpc),
3127
// Provided props override defaults
3228
...props,
3329
// But we force the layers to an empty array because we define them below

src/function/defaults.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { IVpc, SecurityGroup, SubnetSelection, SubnetType } from 'aws-cdk-lib/aws-ec2';
2-
import { VpcForServerlessApp } from '../vpc/VpcForServerlessApp';
31
import { Architecture } from 'aws-cdk-lib/aws-lambda';
42

53
export const functionDefaults = {
@@ -9,23 +7,3 @@ export const functionDefaults = {
97
architecture: Architecture.X86_64,
108
excludedPhpPaths: ['.git', '.idea', 'cdk.out', 'node_modules', '.bref', '.serverless', 'tests'],
119
} as const;
12-
13-
export function vpcDefaults(vpc?: IVpc):
14-
| Record<string, never>
15-
| {
16-
vpc: IVpc;
17-
securityGroups: SecurityGroup[];
18-
vpcSubnets: SubnetSelection;
19-
} {
20-
if (vpc instanceof VpcForServerlessApp) {
21-
// Automatically set the security group and subnets
22-
return {
23-
vpc: vpc,
24-
securityGroups: [vpc.appSecurityGroup],
25-
vpcSubnets: {
26-
subnetType: SubnetType.PRIVATE_WITH_EGRESS,
27-
},
28-
};
29-
}
30-
return {};
31-
}

0 commit comments

Comments
 (0)