-
Notifications
You must be signed in to change notification settings - Fork 1
/
code-repo-access.yaml
116 lines (107 loc) · 3.19 KB
/
code-repo-access.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
107
108
109
110
111
112
113
114
115
116
AWSTemplateFormatVersion: "2010-09-09"
Description: source code repo access users
Parameters:
SourceCodeBucket:
Type: String
Default: repo.surf.advisor
Resources:
repoReadWriteUser:
Type: AWS::IAM::User
Properties:
Policies:
- PolicyName: 'repoReadWriteAccess'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- s3:ListBucket
- s3:GetObject
- s3:PutObject
- s3:DeleteObject
Resource:
- Fn::Join:
- ''
- - 'arn:aws:s3:::'
- Ref: SourceCodeBucket
- '/*'
- Fn::Join:
- ''
- - 'arn:aws:s3:::'
- Ref: SourceCodeBucket
repoReadOnlyUser:
Type: AWS::IAM::User
Properties:
Policies:
- PolicyName: 'repoReadOnlyAccess'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- s3:ListBucket
- s3:GetObject
Resource:
- Fn::Join:
- ''
- - 'arn:aws:s3:::'
- Ref: SourceCodeBucket
- '/*'
- Fn::Join:
- ''
- - 'arn:aws:s3:::'
- Ref: SourceCodeBucket
codeRepoReadOnlyUser:
Type: AWS::IAM::User
Properties:
Policies:
- PolicyName: 'codeRepoReadOnlyAccess'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- s3:ListBucket
- s3:GetObject
Resource:
- Fn::Join:
- ''
- - 'arn:aws:s3:::'
- Ref: SourceCodeBucket
- '/release/*'
- Fn::Join:
- ''
- - 'arn:aws:s3:::'
- Ref: SourceCodeBucket
- '/release'
repoReadWriteUserKeys:
Type: AWS::IAM::AccessKey
Properties:
UserName: !Ref repoReadWriteUser
repoReadOnlyUserKeys:
Type: AWS::IAM::AccessKey
Properties:
UserName: !Ref repoReadOnlyUser
codeRepoReadOnlyUserKeys:
Type: AWS::IAM::AccessKey
Properties:
UserName: !Ref repoReadOnlyUser
Outputs:
rwAccessKey:
Value: !Ref repoReadWriteUserKeys
Description: AWSAccessKeyId of RW
rwSecretKey:
Value: !GetAtt [repoReadWriteUserKeys, SecretAccessKey]
Description: AWSSecretAccessKey of RW
roAccessKey:
Value: !Ref repoReadOnlyUserKeys
Description: AWSAccessKeyId of RO
roSecretKey:
Value: !GetAtt [repoReadOnlyUserKeys, SecretAccessKey]
Description: AWSSecretAccessKey of RO
croAccessKey:
Value: !Ref codeRepoReadOnlyUserKeys
Description: AWSAccessKeyId of CRO
croSecretKey:
Value: !GetAtt [codeRepoReadOnlyUserKeys, SecretAccessKey]
Description: AWSSecretAccessKey of CRO