-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathgrafana-role.yaml
65 lines (65 loc) · 2.14 KB
/
grafana-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
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
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'
ConstraintDescription: 'Must be a valid role description'
S3Bucket:
Type: String
Description: 'The name of the S3 bucket where the logs are stored'
MinLength: 1
MaxLength: 64
AllowedPattern: '[\w+=,.@-]+'
ConstraintDescription: 'Must be a valid S3 bucket name'
KmsKeyArn:
Type: String
Description: 'The ARN of the KMS key used to encrypt and decrypt the logs'
AllowedPattern: '^arn:aws:kms:[a-z0-9-]+:[0-9]{12}:key/[a-f0-9-]+$'
ConstraintDescription: 'Must be a valid KMS key ARN'
AwsAccountwithManagedGrafana:
Type: String
Description: 'The AWS account ID with the managed Grafana'
AllowedPattern: '[0-9]{12}'
ConstraintDescription: 'Must be a valid AWS account ID'
Resources:
IAMRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Ref RoleName
Description: !Ref RoleDescription
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
AWS: !Sub arn:aws:iam::${AwsAccountwithManagedGrafana}:root
Action: sts:AssumeRole
Condition: {}
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AmazonGrafanaAthenaAccess
Policies:
- PolicyName: 'S3Permissions'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action: 's3:*'
Resource:
- !Sub arn:aws:s3:::${S3Bucket}/*
- !Sub arn:aws:s3:::${S3Bucket}
- PolicyName: 'KMSPermissions'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action:
- 'kms:Decrypt'
- 'kms:Encrypt'
Resource: !Ref KmsKeyArn