Skip to content

Commit

Permalink
update perms
Browse files Browse the repository at this point in the history
  • Loading branch information
jindrichskupa committed Oct 18, 2021
1 parent fb56580 commit 2679d0c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ resource "aws_sns_topic_subscription" "this" {
endpoint = aws_lambda_function.this.arn
}

resource "aws_lambda_permission" "sns" {
action = "lambda:InvokeFunction"
function_name = aws_sns_topic.this.name
principal = "sns.amazonaws.com"
statement_id = "AllowSubscriptionToSNS"
source_arn = aws_sns_topic.this.arn
}

resource "aws_lambda_function" "this" {
function_name = var.lambda_name != null ? var.lambda_name : aws_sns_topic.this.name
role = aws_iam_role.this.arn
Expand Down Expand Up @@ -93,8 +101,3 @@ data "aws_iam_policy_document" "sns_topic_policy" {
sid = "__default_statement_ID"
}
}

resource "aws_lambda_event_source_mapping" "example" {
event_source_arn = aws_sns_topic.this.arn
function_name = aws_lambda_function.this.arn
}

0 comments on commit 2679d0c

Please sign in to comment.