Skip to content

Commit 1889c41

Browse files
committed
key policy changes
1 parent 08d4aa5 commit 1889c41

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

infrastructure/terraform/components/acct/module_sandbox_kms.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,15 @@ data "aws_iam_policy_document" "kms" {
103103
resources = ["*"]
104104

105105
condition {
106-
test = "StringEquals"
106+
test = "ArnLike"
107107
variable = "kms:EncryptionContext:aws:sqs:arn"
108108
values = ["arn:aws:sqs:${var.region}:${var.aws_account_id}:*-validate-letter-template-files-queue"]
109109
}
110+
111+
condition {
112+
test = "ArnLike"
113+
variable = "aws:SourceArn"
114+
values = ["arn:aws:events:${var.region}:${var.aws_account_id}:rule/*-quarantine-scan-passed-for-upload"]
115+
}
110116
}
111117
}

infrastructure/terraform/components/app/module_kms.tf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,18 @@ data "aws_iam_policy_document" "kms" {
124124
resources = ["*"]
125125

126126
condition {
127-
test = "StringEquals"
128-
variable = "kms:ViaService"
129-
values = ["sqs.${var.region}.amazonaws.com"]
127+
test = "ArnEquals"
128+
variable = "kms:EncryptionContext:aws:sqs:arn"
129+
values = [
130+
module.backend_api.letter_file_validation_queue_arn
131+
]
130132
}
131133

132134
condition {
133-
test = "StringEquals"
134-
variable = "kms:EncryptionContext:aws:sqs:arn"
135+
test = "ArnEquals"
136+
variable = "aws:SourceArn"
135137
values = [
136-
module.sqs_validate_letter_template_files.sqs_queue_arn
138+
module.backend_api.upload_scan_passed_rule_arn
137139
]
138140
}
139141
}

infrastructure/terraform/modules/backend-api/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@ output "quarantine_bucket_name" {
3838
value = module.s3bucket_quarantine.id
3939
}
4040

41+
output "upload_scan_passed_rule_arn" {
42+
value = aws_cloudwatch_event_rule.guardduty_quarantine_scan_passed_for_upload.arn
43+
}
44+
45+
output "letter_file_validation_queue_arn" {
46+
value = module.sqs_validate_letter_template_files.sqs_queue_arn
47+
}
48+

0 commit comments

Comments
 (0)