mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
added test to verify that managed policies are merged along with vpc config policies
This commit is contained in:
parent
f1d3aecb63
commit
cc4dfca85f
@ -171,6 +171,36 @@ describe('#mergeIamTemplates()', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should merge managed policy arns when vpc config supplied', () => {
|
||||
awsPackage.serverless.service.provider.vpc = {
|
||||
securityGroupIds: ['xxx'],
|
||||
subnetIds: ['xxx'],
|
||||
};
|
||||
const iamManagedPolicies = [
|
||||
'some:aws:arn:xxx:*:*',
|
||||
'someOther:aws:arn:xxx:*:*',
|
||||
{ 'Fn::Join': [':', ['arn:aws:iam:', { Ref: 'AWSAccountId' }, 'some/path']] },
|
||||
];
|
||||
awsPackage.serverless.service.provider.iamManagedPolicies = iamManagedPolicies
|
||||
const expectedManagedPolicyArns = [...iamManagedPolicies,{
|
||||
'Fn::Join': ['',
|
||||
[
|
||||
'arn:',
|
||||
{ Ref: 'AWS::Partition' },
|
||||
':iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole',
|
||||
],
|
||||
],
|
||||
} ]
|
||||
return awsPackage.mergeIamTemplates()
|
||||
.then(() => {
|
||||
expect(awsPackage.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources[awsPackage.provider.naming.getRoleLogicalId()]
|
||||
.Properties
|
||||
.ManagedPolicyArns
|
||||
).to.deep.equal(expectedManagedPolicyArns);
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw error if custom IAM policy statements is not an array', () => {
|
||||
awsPackage.serverless.service.provider.iamRoleStatements = {
|
||||
policy: 'some_value',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user