forked from aws-samples/aws-iam-credential-report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam-credential-report-iam-role.yaml
82 lines (74 loc) · 2.16 KB
/
iam-credential-report-iam-role.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
AWSTemplateFormatVersion: 2010-09-09
Description: Create the AWS IAM role in each account for the IAM Credential Report Blog Post
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Role Attributes
Parameters:
- pIAMRoleName
- pOrgPrimaryLambdaRoleArn
- pTagKey1
- pTagValue1
ParameterLabels:
pIAMRoleName:
default: Credential Report IAM Role Name
pOrgPrimaryLambdaRoleArn:
default: Organization Primary Lambda Role Arn
pTagKey1:
default: Credential Report Role Tag Key
pTagValue1:
default: Credential Report Role Tag Key Value
Parameters:
pIAMRoleName:
Type: String
Description: IAM Role Name
Default: iam-credential-report
pOrgPrimaryLambdaRoleArn:
Type: String
Description: Organization Primary Account Lambda Role Arn
pTagKey1:
Type: String
Description: Tag key
Default: managed-by
pTagValue1:
Type: String
Description: Tag key value
Default: credential-cfn
Resources:
rIAMCredentialReportRole:
Type: AWS::IAM::Role
Metadata:
cfn_nag:
rules_to_suppress:
- id: W11
reason: IAM role should not allow * resource on its permissions policy
- id: F3
reason: IAM role should not allow * resource on its permissions policy
Properties:
RoleName: !Ref pIAMRoleName
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
AWS: !Ref pOrgPrimaryLambdaRoleArn
Action: sts:AssumeRole
Path: "/"
Policies:
- PolicyName: iam-credential-report-org-policy
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- "iam:GenerateCredentialReport"
- "iam:GetCredentialReport"
Resource: "*"
Tags:
- Key: !Ref pTagKey1
Value: !Ref pTagValue1
Outputs:
oIAMCredentialReportRole:
Description: IAMCredentialReportRoleArn
Value: !GetAtt rIAMCredentialReportRole.Arn