-
Notifications
You must be signed in to change notification settings - Fork 2
/
oidc-setup.yaml
45 lines (42 loc) · 1.13 KB
/
oidc-setup.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
Parameters:
GithubOrg:
Type: String
Default: example-org
RepoName:
Type: String
Default: cfn-cicd
RoleName:
Type: String
Default: GitHubOidcRole
Resources:
Role:
Type: AWS::IAM::Role
Properties:
RoleName: !Ref RoleName
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Action: sts:AssumeRoleWithWebIdentity
Principal:
Federated: !Ref GithubOidc
Condition:
StringLike:
token.actions.githubusercontent.com:sub: !Sub repo:${GithubOrg}/${RepoName}:*
Policies:
- PolicyName: GitHubOidcPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: sts:AssumeRole
Resource: !Sub arn:aws:iam::${AWS::AccountId}:role/cdk-*
GithubOidc:
Type: AWS::IAM::OIDCProvider
Properties:
Url: https://token.actions.githubusercontent.com
ThumbprintList: [1b511abead59c6ce207077c0bf0e0043b1382612]
ClientIdList:
- sts.amazonaws.com
Outputs:
Role:
Value: !GetAtt Role.Arn