-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
79 lines (73 loc) · 2.48 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: SAM Template for Team Responsibility Manager
Metadata:
AWS::ServerlessRepo::Application:
Name: team-responsibility-manager
Description: TRM keeps track of shared responsibilities and notifies teams when a responsibility rotates from one person to the next.
Author: nicholsonjf
SpdxLicenseId: Apache-2.0
LicenseUrl: LICENSE.txt
ReadmeUrl: README.md
Labels: ['slack']
HomePageUrl: https://github.com/nicholsonjf/team-responsibility-manager
SemanticVersion: '0.1.1'
SourceCodeUrl: https://github.com/nicholsonjf/team-responsibility-manager
Globals:
Function:
Timeout: 3
Parameters:
ShouldCreateBucketInputParameter:
Type: String
Default: 'true'
AllowedValues:
- 'true'
- 'false'
ConstraintDescription: Allowed values are 'true' or 'false'.
Description: Whether to create the S3 bucket used by this application.
BucketNameParameter:
Type: String
AllowedPattern: '^[a-z0-9]{3,63}$'
ConstraintDescription: Bucket name must be between 3-63 characters and contain only lowercase letters and numbers.
Description: The name of S3 bucket used by this application.
Conditions:
CreateS3Condition: !Equals [!Ref ShouldCreateBucketInputParameter, 'true']
Resources:
TRMBucket:
Condition: CreateS3Condition
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !Ref BucketNameParameter
TRMFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
Timeout: 15
MemorySize: 512
PackageType: Image
Architectures:
- x86_64
Policies:
- S3CrudPolicy:
BucketName: !Ref BucketNameParameter
Environment:
Variables:
BUCKET_NAME: !Ref BucketNameParameter
Events:
EventBridge:
Type: Schedule
Properties:
Schedule: 'cron(0/15 * * * ? *)'
Name: TRMEventSchedule
Description: Every 15 minutes
Enabled: true
Metadata:
Dockerfile: Dockerfile
DockerContext: ./src
DockerTag: python3.9-v1
Outputs:
TRMFunction:
Description: "TRM Lambda Function ARN"
Value: !GetAtt TRMFunction.Arn
TRMFunctionIamRole:
Description: "Implicit IAM Role created for the TRM function"
Value: !GetAtt TRMFunctionRole.Arn