-
Notifications
You must be signed in to change notification settings - Fork 10
/
kms.tf
37 lines (31 loc) · 925 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
# #########################################
# KMS
# #########################################
data "aws_iam_policy_document" "kms" {
statement {
actions = ["kms:*"]
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
}
resources = ["*"]
}
}
resource "aws_kms_alias" "sqs" {
name = format("alias/%s-sqs", module.labels.id)
target_key_id = aws_kms_key.sqs.key_id
}
resource "aws_kms_alias" "sns" {
name = format("alias/%s-sns", module.labels.id)
target_key_id = aws_kms_key.sns.key_id
}
resource "aws_kms_key" "sqs" {
description = "KMS key for SQS"
policy = data.aws_iam_policy_document.kms.json
tags = module.labels.tags
}
resource "aws_kms_key" "sns" {
description = "KMS key for SNS"
policy = data.aws_iam_policy_document.kms.json
tags = module.labels.tags
}