-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam_resource_lister.yaml
47 lines (45 loc) · 1.5 KB
/
iam_resource_lister.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
AWSTemplateFormatVersion: '2010-09-09'
Description: >
StackSet template to create the IAM role P0RoleIamResourceLister
with an inline policy P0RoleIamResourceListerPolicy.
Parameters:
GoogleAudienceId:
Type: String
Description: Google Audience ID for SAML federation.
TargetAccountId:
Type: String
Description: AWS Account ID for the aws:ResourceAccount condition.
Resources:
P0RoleIamResourceLister:
Type: AWS::IAM::Role
Properties:
RoleName: P0RoleIamResourceLister
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Federated: accounts.google.com
Action: sts:AssumeRoleWithWebIdentity
Condition:
StringEquals:
accounts.google.com:aud: !Ref GoogleAudienceId
Policies:
- PolicyName: P0RoleIamResourceListerPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: P0CanListResources
Effect: Allow
Action:
- 'resource-explorer-2:ListIndexes'
- 'resource-explorer-2:Search'
- 'iam:GetRole'
- 'iam:GetRolePolicy'
Resource: '*'
Condition:
StringEquals:
aws:ResourceAccount: !Sub "${AWS::AccountId}"
Tags:
- Key: P0Security
Value: !Sub 'Created using StackSet by ${AWS::AccountId}'