-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathcross_account_roles_unutilized_wafs.yaml
72 lines (71 loc) · 2.3 KB
/
cross_account_roles_unutilized_wafs.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
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
GithubOrganization:
Type: String
Description: 'The name of the your github Organization'
MinLength: 1
MaxLength: 64
AllowedPattern: '[\w+=,.@-]+'
RoleName:
Type: String
Description: 'The name of the role to be created'
MinLength: 1
MaxLength: 64
AllowedPattern: '[\w+=,.@-]+'
ConstraintDescription: 'Must be a valid role name'
RoleDescription:
Type: String
Description: 'The description of the role to be created'
MinLength: 1
MaxLength: 1000
ConstraintDescription: 'Must be a valid role description'
Resources:
IAMRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Ref RoleName
Description: !Ref RoleDescription
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Federated: !Sub arn:aws:iam::${AWS::Accountid}:oidc-provider/token.actions.githubusercontent.com
Action: sts:AssumeRoleWithWebIdentity
Condition:
StringEquals:
token.actions.githubusercontent.com:aud: sts.amazonaws.com
StringLike:
token.actions.githubusercontent.com:sub: !Sub repo:/${GithubOrganization}aws-firewall-factory:*
Policies:
- PolicyName: 'IAMPermissions'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action: 'iam:ListAccountAliases'
Resource: '*'
- PolicyName: 'Ec2Permissions'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action: 'ec2:DescribeRegions'
Resource: '*'
- PolicyName: 'CloudFrontPermissions'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action:
- 'cloudfront:ListDistributionsByWebACLId'
Resource: '*'
- PolicyName: 'WAFPermissionPolicy'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action:
- 'wafv2:ListResourcesForWebACL'
- 'wafv2:ListWebACLs'
Resource: '*'