From f3c478b50b65f2d2dae6453dbfa1eae772c4be55 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Fri, 4 Nov 2016 13:25:11 +0100 Subject: [PATCH] Remove iamRoleARN support --- docs/providers/aws/guide/functions.md | 6 +++--- .../aws/deploy/lib/mergeIamTemplates.js | 2 +- .../aws/deploy/tests/mergeIamTemplates.js | 21 ------------------- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/docs/providers/aws/guide/functions.md b/docs/providers/aws/guide/functions.md index 61b5a88d6..5fced6a9c 100644 --- a/docs/providers/aws/guide/functions.md +++ b/docs/providers/aws/guide/functions.md @@ -153,7 +153,7 @@ functions: memorySize: 512 ``` -You can also use an existing IAM role by adding your IAM Role ARN in the `iamRoleARN` property. For example: +You can also use an existing IAM role by adding your IAM Role ARN in the `role` property. For example: ```yml # serverless.yml @@ -161,10 +161,10 @@ You can also use an existing IAM role by adding your IAM Role ARN in the `iamRol service: new-service provider: name: aws - iamRoleARN: arn:aws:iam::YourAccountNumber:role/YourIamRole + role: arn:aws:iam::YourAccountNumber:role/YourIamRole ``` -Support for separate IAM Roles per function is coming soon. +See the documentation about [IAM](./iam.md) for function level IAM roles. ## VPC Configuration diff --git a/lib/plugins/aws/deploy/lib/mergeIamTemplates.js b/lib/plugins/aws/deploy/lib/mergeIamTemplates.js index 4422deb94..1003e383c 100644 --- a/lib/plugins/aws/deploy/lib/mergeIamTemplates.js +++ b/lib/plugins/aws/deploy/lib/mergeIamTemplates.js @@ -21,7 +21,7 @@ module.exports = { } if (!anyFunctionHasNoRole) return BbPromise.resolve(); - if (typeof this.serverless.service.provider.iamRoleARN !== 'string') { + if (typeof this.serverless.service.provider.role !== 'string') { // merge in the iamRoleLambdaTemplate const iamRoleLambdaExecutionTemplate = this.serverless.utils.readFileSync( path.join(this.serverless.config.serverlessPath, diff --git a/lib/plugins/aws/deploy/tests/mergeIamTemplates.js b/lib/plugins/aws/deploy/tests/mergeIamTemplates.js index 833b02c4c..b11b8d2f5 100644 --- a/lib/plugins/aws/deploy/tests/mergeIamTemplates.js +++ b/lib/plugins/aws/deploy/tests/mergeIamTemplates.js @@ -112,27 +112,6 @@ describe('#mergeIamTemplates()', () => { }); }); - it('should not add IamPolicyLambdaExecution if arn is provided', () => { - awsDeploy.serverless.service.provider.iamRoleARN = 'some:aws:arn:xxx:*:*'; - - return awsDeploy.mergeIamTemplates() - .then(() => expect( - awsDeploy.serverless.service.provider.compiledCloudFormationTemplate - .Resources.IamPolicyLambdaExecution - ).to.not.exist); - }); - - - it('should not add IamRole if arn is provided', () => { - awsDeploy.serverless.service.provider.iamRoleARN = 'some:aws:arn:xxx:*:*'; - - return awsDeploy.mergeIamTemplates() - .then(() => expect( - awsDeploy.serverless.service.provider.compiledCloudFormationTemplate - .Resources.IamRoleLambdaExecution - ).to.not.exist); - }); - it('should add a CloudWatch LogGroup resource', () => { awsDeploy.serverless.service.provider.cfLogs = true; const normalizedName = `${functionName[0].toUpperCase()}${functionName.substr(1)}LogGroup`;