Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Sep 6, 2023
1 parent b5fc8ae commit 0f89d2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cloudtrail/sns.s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ data "aws_iam_policy_document" "cloudtrail_s3_topic" {
## values = [local.account_id]
## }
condition {
test = "ArnLike"
variable = "AWS:SourceArn"
test = ""
variable = "aws:SourceArn"
values = [aws_s3_bucket.this.arn]
}
}
Expand Down
15 changes: 15 additions & 0 deletions cloudtrail/sqs.s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ data "aws_iam_policy_document" "cloudtrail_s3_sqs" {
values = [var.enable_s3_sns ? aws_sns_topic.cloudtrail_s3[0].arn : ""]
}
}
statement {
sid = "AllowSQSS3SendMessage"
effect = "Allow"
principals {
type = "Service"
identifiers = ["s3.amazonaws.com"]
}
actions = ["sqs:SendMessage"]
resources = [var.enable_s3_sqs ? aws_sqs_queue.cloudtrail_s3[0].arn : ""]
condition {
test = "ArnEquals"
variable = "aws:SourceArn"
values = [var.enable_s3_sns ? aws_sns_topic.cloudtrail_s3[0].arn : ""]
}
}
}

resource "aws_sns_topic_subscription" "cloudtrail_s3_sqs" {
Expand Down

0 comments on commit 0f89d2a

Please sign in to comment.