Closed shaykeren closed 3 years ago
Hi, Any updates on this one?
There is a test case that verifies one is not created if all DelploymentPreferences specify a role.
function_with_deployment_no_service_role.yaml
To research your bug we would need more details about the template you are using.
I just tried to reproduce this and I could not reproduce this, below is my template. I do not see any codeservice deploy role being created.
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
sam-app
Sample SAM Template for sam-app
Globals:
Function:
Timeout: 3
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Runtime: python3.8
AutoPublishAlias: "Myalias"
DeploymentPreference:
Enabled: True
Type: AllAtOnce
Role: arn:aws:iam::<myaccount>:role/<myrolename>
Events:
HelloWorld:
Type: Api
Properties:
Path: /hello
Method: get
I'm closing this issue, please comment here if you still are facing this issue and provide your template too for investigation.
Description
Redundant role created when using sam deploy. My sam template has serverless function which enable gradual Lambda, using DeploymentPreference. I set the Role property with a predefined Role Arn. In the documentation it says that "An IAM role will not be created if this is provided" reference
sam deploy will create role with name CodeDeployServiceRole, although I specified a specific role arn under the DeploymentPreference section.
<when viewing the processed template I can see that the the resource of type AWS::CodeDeploy::DeploymentGroup has ServiceRoleArn with my specified role arn and also new role with name CodeDeployServiceRole
Steps to reproduce
create sam template with severless function and set role arn under the DeploymentPreference/Role run sam deploy and observe CodeDeployServiceRole role was created
Observed result
Expected result
Role should not being created
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.3.2Add --debug flag to command you are running