Check if default policy is available when merging PolicyDocument statements for streams

This commit is contained in:
Philipp Muens 2016-11-07 15:29:47 +01:00
parent 5ad10516d2
commit e76706fb6e

View File

@ -113,20 +113,23 @@ class AwsCompileStreamEvents {
};
}
// update the PolicyDocument statements
const statement = this.serverless.service.provider.compiledCloudFormationTemplate
.Resources
.IamPolicyLambdaExecution
.Properties
.PolicyDocument
.Statement;
// update the PolicyDocument statements (if default policy is used)
if (this.serverless.service.provider.compiledCloudFormationTemplate
.Resources.IamPolicyLambdaExecution) {
const statement = this.serverless.service.provider.compiledCloudFormationTemplate
.Resources
.IamPolicyLambdaExecution
.Properties
.PolicyDocument
.Statement;
this.serverless.service.provider.compiledCloudFormationTemplate
.Resources
.IamPolicyLambdaExecution
.Properties
.PolicyDocument
.Statement = statement.concat([streamStatement]);
this.serverless.service.provider.compiledCloudFormationTemplate
.Resources
.IamPolicyLambdaExecution
.Properties
.PolicyDocument
.Statement = statement.concat([streamStatement]);
}
const newStreamObject = {
[`${normalizedFunctionName}EventSourceMapping${