|
@@ -1,3 +1,13 @@
|
|
|
|
+locals {
|
|
|
|
+ kms_users = concat(
|
|
|
|
+ [
|
|
|
|
+ "arn:${var.aws_partition}:iam::${var.aws_account_id}:user/MDRAdmin",
|
|
|
|
+ "arn:${var.aws_partition}:iam::${var.aws_account_id}:role/user/mdr_terraformer",
|
|
|
|
+ ],
|
|
|
|
+ local.accounts
|
|
|
|
+ )
|
|
|
|
+}
|
|
|
|
+
|
|
resource "aws_kms_key" "bucketkey" {
|
|
resource "aws_kms_key" "bucketkey" {
|
|
description = "S3 KMS for ${var.name}."
|
|
description = "S3 KMS for ${var.name}."
|
|
deletion_window_in_days = 30
|
|
deletion_window_in_days = 30
|
|
@@ -62,10 +72,7 @@ data "aws_iam_policy_document" "kms_key_policy" {
|
|
effect = "Allow"
|
|
effect = "Allow"
|
|
principals {
|
|
principals {
|
|
type = "AWS"
|
|
type = "AWS"
|
|
- identifiers = [
|
|
|
|
- "arn:${var.aws_partition}:iam::${var.aws_account_id}:user/MDRAdmin",
|
|
|
|
- "arn:${var.aws_partition}:iam::${var.aws_account_id}:role/user/mdr_terraformer",
|
|
|
|
- ]
|
|
|
|
|
|
+ identifiers = local.kms_users
|
|
}
|
|
}
|
|
actions = [
|
|
actions = [
|
|
"kms:Encrypt",
|
|
"kms:Encrypt",
|
|
@@ -102,4 +109,3 @@ data "aws_iam_policy_document" "kms_key_policy" {
|
|
|
|
|
|
# TODO: Do we need to grant read access to other accounts?
|
|
# TODO: Do we need to grant read access to other accounts?
|
|
}
|
|
}
|
|
-
|
|
|