Skip to content

Commit 4443c26

Browse files
committed
CCM-13451: Queue policy dependency fix
1 parent fa493dc commit 4443c26

File tree

2 files changed

+55
-58
lines changed

2 files changed

+55
-58
lines changed

infrastructure/terraform/components/api/module_sqs_letter_updates.tf

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,59 @@ module "sqs_letter_updates" {
1313
visibility_timeout_seconds = 60
1414

1515
create_dlq = true
16+
sqs_policy_overload = data.aws_iam_policy_document.letter_updates_queue_policy.json
17+
}
18+
19+
data "aws_iam_policy_document" "letter_updates_queue_policy" {
20+
version = "2012-10-17"
21+
statement {
22+
sid = "AllowSNSToSendMessage"
23+
effect = "Allow"
24+
25+
principals {
26+
type = "Service"
27+
identifiers = ["sns.amazonaws.com"]
28+
}
29+
30+
actions = [
31+
"sqs:SendMessage"
32+
]
33+
34+
resources = [
35+
"arn:aws:sqs:${var.region}:${var.aws_account_id}:${var.project}-${var.environment}-${var.component}-letter-updates-queue"
36+
]
37+
38+
condition {
39+
test = "ArnEquals"
40+
variable = "aws:SourceArn"
41+
values = [module.eventsub.sns_topic.arn]
42+
}
43+
}
44+
45+
statement {
46+
sid = "AllowSNSPermissions"
47+
effect = "Allow"
48+
49+
principals {
50+
type = "Service"
51+
identifiers = ["sns.amazonaws.com"]
52+
}
53+
54+
actions = [
55+
"sqs:SendMessage",
56+
"sqs:ListQueueTags",
57+
"sqs:GetQueueUrl",
58+
"sqs:GetQueueAttributes",
59+
]
60+
61+
resources = [
62+
"arn:aws:sqs:${var.region}:${var.aws_account_id}:${var.project}-${var.environment}-${var.component}-letter-updates-queue"
63+
]
64+
65+
condition {
66+
test = "ArnEquals"
67+
variable = "aws:SourceArn"
68+
values = [module.eventsub.sns_topic.arn]
69+
}
70+
}
1671
}

infrastructure/terraform/components/api/sqs_queue_policy_letter_updates.tf

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)