integration/resources/templates/combination/function_with_deployment_globals.yaml (47 lines of code) (raw):
Parameters:
TypeParam:
Default: AllAtOnce
Type: String
Globals:
Function:
DeploymentPreference:
Type:
Ref: TypeParam
Role:
Fn::GetAtt: [DeploymentRole, Arn]
Resources:
MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ${codeuri}
Handler: index.handler
Runtime: python3.11
AutoPublishAlias: Live
DeploymentRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- codedeploy.amazonaws.com
Policies:
- PolicyName: root
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Resource: '*'
Action:
- cloudwatch:DescribeAlarms
- lambda:UpdateAlias
- lambda:GetAlias
- lambda:InvokeFunction
- s3:Get*
- sns:Publish
Metadata:
SamTransformTest: true