Skip to content

Commit 8b4bf77

Browse files
committed
add sqs queue policy
1 parent aeba01f commit 8b4bf77

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

terraform/sqs_id_sync.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,32 @@ resource "aws_sqs_queue_redrive_allow_policy" "id_sync_queue_redrive_allow_polic
2323
sourceQueueArns = [aws_sqs_queue.id_sync_queue.arn]
2424
})
2525
}
26+
27+
# IAM policy.
28+
# TODO: this is currently a global allow policy.
29+
# Refine this to allow receive from our lambda, and send from MNS
30+
31+
data "aws_iam_policy_document" "id_sync_sqs_policy" {
32+
statement {
33+
sid = "id-sync-queue SQS statement"
34+
effect = "Allow"
35+
36+
principals {
37+
type = "AWS"
38+
identifiers = ["*"]
39+
}
40+
41+
actions = [
42+
"sqs:SendMessage",
43+
"sqs:ReceiveMessage"
44+
]
45+
resources = [
46+
aws_sqs_queue.id_sync_queue.arn
47+
]
48+
}
49+
}
50+
51+
resource "aws_sqs_queue_policy" "id_sync_sqs_policy" {
52+
queue_url = aws_sqs_queue.id_sync_queue.id
53+
policy = data.aws_iam_policy_document.id_sync_sqs_policy.json
54+
}

0 commit comments

Comments
 (0)