Skip to content

Commit

Permalink
fix: Revert vpc configuration on custom resources (#12001)
Browse files Browse the repository at this point in the history
This reverts  #11985 (commit f2d1e23)
  • Loading branch information
medikoo committed Jun 1, 2023
1 parent 83e194c commit d0e3056
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
7 changes: 0 additions & 7 deletions lib/plugins/aws/custom-resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,6 @@ async function addCustomResourceToService(awsProvider, resourceName, iamRoleStat
};
Resources[customResourceFunctionLogicalId] = customResourceFunction;

if (providerConfig.vpc && providerConfig.vpc.securityGroupIds && providerConfig.vpc.subnetIds) {
customResourceFunction.Properties.VpcConfig = {
SecurityGroupIds: providerConfig.vpc.securityGroupIds,
SubnetIds: providerConfig.vpc.subnetIds,
};
}

if (customDeploymentRole) {
customResourceFunction.Properties.Role = customDeploymentRole;
} else {
Expand Down
27 changes: 0 additions & 27 deletions test/unit/lib/plugins/aws/custom-resources/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,33 +347,6 @@ describe('#addCustomResourceToService()', () => {
Resources.CustomDashresourceDashexistingDashs3LambdaFunction.Properties.FunctionName.length
).to.be.below(65);
});

it('should configure vpc configs for the custom resource lambda function if vpc is configured', async () => {
const vpcConfig = {
securityGroupIds: ['sg-0a0a0a0a'],
subnetIds: ['subnet-01010101'],
};
const { cfTemplate } = await runServerless({
fixture: 'api-gateway',
command: 'package',
configExt: {
provider: {
logs: {
restApi: true,
},
vpc: vpcConfig,
},
},
});

const properties =
cfTemplate.Resources.CustomDashresourceDashapigwDashcwDashroleLambdaFunction.Properties;

expect(properties.VpcConfig).to.deep.equal({
SecurityGroupIds: ['sg-0a0a0a0a'],
SubnetIds: ['subnet-01010101'],
});
});
});

describe('test/unit/lib/plugins/aws/customResources/index.test.js', () => {
Expand Down

0 comments on commit d0e3056

Please sign in to comment.