-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.yaml
106 lines (106 loc) · 3.28 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Parameters:
snsScanResultTopicArn:
Type: String
Description: FSS Results SNS Topic ARN.
LambdaZipBucket:
Type: String
Description: S3 bucket for lambda zip. If your have it under s3://bucket/path/to/zip.zip, enter 'bucket' here.
LambdaZipKey:
Type: String
Description: S3 key for lambda zip. If your have it under s3://bucket/path/to/zip.zip, enter 'path/to/zip.zip' here.
Resources:
sentToSecurityHubLambdaFunctionServiceRole58D0F596:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: lambda.amazonaws.com
Version: "2012-10-17"
ManagedPolicyArns:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
sentToSecurityHubLambdaFunctionServiceRoleDefaultPolicy9B55E2DF:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action: securityhub:BatchImportFindings
Effect: Allow
Resource:
Fn::Join:
- ""
- - "arn:aws:securityhub:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- :product/
- Ref: AWS::AccountId
- /default
Version: "2012-10-17"
PolicyName: sentToSecurityHubLambdaFunctionServiceRoleDefaultPolicy9B55E2DF
Roles:
- Ref: sentToSecurityHubLambdaFunctionServiceRole58D0F596
sentToSecurityHubLambdaFunction532BC798:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket:
Ref: LambdaZipBucket
S3Key:
Ref: LambdaZipKey
Handler: index.handler
Role:
Fn::GetAtt:
- sentToSecurityHubLambdaFunctionServiceRole58D0F596
- Arn
Runtime: nodejs12.x
Environment:
Variables:
SECURITY_HUB_ARN:
Fn::Join:
- ""
- - "arn:aws:securityhub:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- :product/
- Ref: AWS::AccountId
- /default
ACCOUNT_ID:
Ref: AWS::AccountId
DependsOn:
- sentToSecurityHubLambdaFunctionServiceRoleDefaultPolicy9B55E2DF
- sentToSecurityHubLambdaFunctionServiceRole58D0F596
sentToSecurityHubLambdaFunctionAllowInvokeFssToSecurityhubStacksnsScanResultTopic91BD24BC8B29A3C3:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- sentToSecurityHubLambdaFunction532BC798
- Arn
Principal: sns.amazonaws.com
SourceArn:
Ref: snsScanResultTopicArn
sentToSecurityHubLambdaFunctionsnsScanResultTopic97C3C50C:
Type: AWS::SNS::Subscription
Properties:
Protocol: lambda
TopicArn:
Ref: snsScanResultTopicArn
Endpoint:
Fn::GetAtt:
- sentToSecurityHubLambdaFunction532BC798
- Arn
Region:
Fn::Select:
- 3
- Fn::Split:
- ":"
- Ref: snsScanResultTopicArn