Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UML-3738: create kms key #3035

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions terraform/account/kms.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,63 @@ data "aws_iam_policy_document" "cloudwatch_kms" {
}
}
}


module "event_receiver_mrk" {
source = "./modules/multi_region_kms"

key_description = "KMS key for received events"
key_alias = "${local.environment}-event-receiver-mrk"
key_policy = data.aws_iam_policy_document.event_receiver_kms.json
deletion_window_in_days = 7

providers = {
aws.primary = aws.eu_west_1
aws.secondary = aws.eu_west_2
}
}

data "aws_iam_policy_document" "event_receiver_kms" {
statement {
sid = "Allow Encryption by Service"
effect = "Allow"
resources = [
"arn:aws:kms:*:${data.aws_caller_identity.current.account_id}:key/*"
]
actions = [
"kms:Encrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey",
]

principals {
type = "Service"
identifiers = [
"events.amazonaws.com",
]
}
}

statement {
sid = "Allow Decryption by Service"
effect = "Allow"
resources = [
"arn:aws:kms:*:${data.aws_caller_identity.current.account_id}:key/*"
]
actions = [
"kms:Decrypt",
"kms:GenerateDataKey*",
"kms:DescribeKey",
]

principals {
type = "Service"
identifiers = [
"sqs.amazonaws.com",
"events.amazonaws.com",
"lambda.amazonaws.com",
]
}
}
}
Loading