-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathkms.tf
45 lines (38 loc) · 884 Bytes
/
kms.tf
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
resource "aws_kms_key" "this" {
description = "KMS Key for cloudwatch SSM logging"
deletion_window_in_days = 10
enable_key_rotation = true
policy = data.aws_iam_policy_document.kms_key_policy.json
}
data "aws_iam_policy_document" "kms_key_policy" {
statement {
effect = "Allow"
principals {
type = "AWS"
identifiers = [
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"
]
}
actions = [
"kms:*",
]
resources = ["*"]
}
statement {
effect = "Allow"
principals {
type = "Service"
identifiers = [
"logs.${data.aws_region.current.name}.amazonaws.com"
]
}
actions = [
"kms:Encrypt*",
"kms:Decrypt*",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:Describe*"
]
resources = ["*"]
}
}