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