Skip to content

Commit 3e8d68e

Browse files
merge
2 parents 3ac7dae + 64fb6a8 commit 3e8d68e

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

cfn/ESDK-Python.yml

+19
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Resources:
174174
- !Ref CodeBuildBatchPolicy
175175
- !Ref CodeBuildBasePolicy
176176
- !Ref SecretsManagerPolicy
177+
- !Ref CodeBuildCISTSAllow
177178

178179
CodeBuildCIServiceRole:
179180
Type: "AWS::IAM::Role"
@@ -187,6 +188,7 @@ Resources:
187188
- !Ref CodeBuildCIBatchPolicy
188189
- !Ref CodeBuildBasePolicy
189190
- !Ref SecretsManagerCIPolicy
191+
- !Ref CodeBuildCISTSAllow
190192

191193
CodeBuildBatchPolicy:
192194
Type: "AWS::IAM::ManagedPolicy"
@@ -360,3 +362,20 @@ Resources:
360362
}
361363
]
362364
}
365+
366+
CodeBuildCISTSAllow:
367+
Type: "AWS::IAM::ManagedPolicy"
368+
Properties:
369+
ManagedPolicyName: !Sub CodeBuildCISTSAllow-${ProjectName}
370+
Path: /service-role/
371+
PolicyDocument: |
372+
{
373+
"Version": "2012-10-17",
374+
"Statement": [
375+
{
376+
"Effect": "Allow",
377+
"Action": "sts:AssumeRole",
378+
"Resource": "arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Python-Role-us-west-2"
379+
}
380+
]
381+
}

cfn/Public-ESDK-Python-CI.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
AWSTemplateFormatVersion: "2010-09-09"
2+
Description: "IAM Managed Policies/Role for AWS KMS Hierarchical Keyring Testing"
3+
4+
Parameters:
5+
ProjectName:
6+
Type: String
7+
Description: A prefix that will be applied to any resource names
8+
Default: Public-ESDK-Python
9+
GitHubRepo:
10+
Type: String
11+
Description: GitHub Repo that invokes CI
12+
Default: aws/aws-encryption-sdk-python
13+
14+
Resources:
15+
GitHubCIRole:
16+
Type: 'AWS::IAM::Role'
17+
Properties:
18+
RoleName: !Sub "GitHub-CI-${ProjectName}-Role-${AWS::Region}"
19+
Description: "Access DDB, KMS, Resources for CI from GitHub"
20+
ManagedPolicyArns:
21+
- "arn:aws:iam::370957321024:policy/ESDK-Dafny-DDB-ReadWriteDelete-us-west-2"
22+
- "arn:aws:iam::370957321024:policy/Hierarchical-GitHub-KMS-Key-Policy"
23+
- "arn:aws:iam::370957321024:policy/KMS-Public-CMK-EncryptDecrypt-Key-Access"
24+
- "arn:aws:iam::370957321024:policy/RSA-GitHub-KMS-Key-Policy"
25+
AssumeRolePolicyDocument: !Sub |
26+
{
27+
"Version": "2012-10-17",
28+
"Statement": [
29+
{
30+
"Effect": "Allow",
31+
"Principal": { "Federated": "arn:aws:iam::${AWS::AccountId}:oidc-provider/token.actions.githubusercontent.com" },
32+
"Action": "sts:AssumeRoleWithWebIdentity",
33+
"Condition": {
34+
"StringEquals": {
35+
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
36+
},
37+
"StringLike": {
38+
"token.actions.githubusercontent.com:sub": "repo:${GitHubRepo}:*"
39+
}
40+
}
41+
},
42+
{
43+
"Effect": "Allow",
44+
"Principal": {
45+
"AWS": "*"
46+
},
47+
"Action": "sts:AssumeRole",
48+
"Condition": {
49+
"StringEquals": {
50+
"aws:PrincipalArn": [
51+
"arn:aws:iam::587316601012:role/service-role/codebuild-python-esdk-CI-service-role",
52+
"arn:aws:iam::587316601012:role/service-role/codebuild-python-esdk-service-role",
53+
"arn:aws:iam::${AWS::AccountId}:role/ToolsDevelopment"
54+
]
55+
}
56+
}
57+
}
58+
]
59+
}

0 commit comments

Comments
 (0)