Skip to content

Commit

Permalink
Merge pull request #25 from dasmeta/DMVP-5181
Browse files Browse the repository at this point in the history
fix(DMVP-5181): fix sqs policy
  • Loading branch information
sophie-dasmeta-com authored Dec 24, 2024
2 parents c3ccea4 + 423b7b9 commit 96ee295
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions event-notifications.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data "aws_iam_policy_document" "queue" {
}

actions = ["sqs:SendMessage"]
resources = ["arn:aws:sqs:*:*:${var.name}${var.event_notification_config.name_suffix}}"]
resources = ["arn:aws:sqs:*:*:${local.queue_name}"]

condition {
test = "ArnEquals"
Expand All @@ -23,7 +23,7 @@ data "aws_iam_policy_document" "queue" {
resource "aws_sqs_queue" "queue" {
count = var.event_notification_config.target_type == "sqs" ? 1 : 0

name = replace("${var.name}${var.event_notification_config.name_suffix}", "/\\W+/", "_")
name = local.queue_name
policy = data.aws_iam_policy_document.queue[0].json
}

Expand Down
1 change: 1 addition & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
locals {
name_formed = replace(var.name, "/\\W|_|\\s/", "-")
iam_user_name = coalesce(var.iam_user_name, "${local.name_formed}-s3-usr")
queue_name = replace("${var.name}-${var.event_notification_config.name_suffix}", "/\\W+/", "_")
}

0 comments on commit 96ee295

Please sign in to comment.