forked from mozilla-iam/auth0-custom-lock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codebuild-role.yml
102 lines (102 loc) · 2.8 KB
/
codebuild-role.yml
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
AWSTemplateFormatVersion: "2010-09-09"
Description: "Stack for setting up the NLX CI role."
Parameters:
KMSKeyArn:
Type: String
Default: arn:aws:kms:us-west-2:320464205386:key/ef00015d-739b-456d-a92f-482712af4f32
Description: The ARN of the kms key protecting secure-strings.
CDNS3BucketArn:
Type: String
Default: arn:aws:s3:::sso-dashboard.configuration
Description: The arn of the s3 bucket that you want the lock deployed to.
CloudFrontDistributionIDArn:
Type: String
Description: The arn of the cloudfront distribution for performing cache invalidations.
Resources:
CodeBuildNLXRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Principal:
Service:
- "codebuild.amazonaws.com"
Action:
- "sts:AssumeRole"
Path: "/iam/nlx/"
RoleName: codebuild-nlx-ci
CIParameterStore:
Type: "AWS::IAM::Policy"
DependsOn: CodeBuildNLXRole
Properties:
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Action:
- "ssm:GetParameter"
- "ssm:GetParameters"
Resource: "arn:aws:ssm:*:*:parameter/iam/nlx/*"
-
Effect: "Allow"
Action:
- "kms:Decrypt"
Resource: !Ref KMSKeyArn
PolicyName: get-automated-test-parameters
Roles:
-
Ref: CodeBuildNLXRole
CIToCloudWatch:
Type: "AWS::IAM::Policy"
DependsOn: CodeBuildNLXRole
Properties:
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Action:
- "logs:CreateLogGroup"
- "logs:CreateLogStream"
- "logs:PutLogEvents"
Resource: "arn:aws:logs:*:*:log-group:/aws/codebuild/*"
PolicyName: put-cloudwatch-logs
Roles:
-
Ref: CodeBuildNLXRole
CIToS3:
Type: "AWS::IAM::Policy"
DependsOn: CodeBuildNLXRole
Properties:
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Action:
- "s3:*"
Resource: !Join [ '', [ !Ref CDNS3BucketArn, '**' ] ]
PolicyName: put-lock-to-cdn
Roles:
-
Ref: CodeBuildNLXRole
CIToCloudfront:
Type: "AWS::IAM::Policy"
DependsOn: CodeBuildNLXRole
Properties:
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Action:
- "cloudfront:CreateInvalidation"
Resource: '*'
PolicyName: all-to-cloudfront
Roles:
-
Ref: CodeBuildNLXRole