File tree Expand file tree Collapse file tree
eventbridge-sns-lambda-terraform Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,12 +106,8 @@ resource "aws_lambda_function" "lambda_function" {
106106 runtime = " nodejs22.x"
107107}
108108
109-
110109resource "aws_iam_role" "lambda_iam_role" {
111- name_prefix = " LambdaSNSRole-"
112- managed_policy_arns = [
113- data . aws_iam_policy . lambda_basic_execution_role_policy . arn
114- ]
110+ name_prefix = " LambdaSNSRole-"
115111
116112 assume_role_policy = << EOF
117113{
@@ -130,6 +126,11 @@ resource "aws_iam_role" "lambda_iam_role" {
130126EOF
131127}
132128
129+ resource "aws_iam_role_policy_attachment" "lambda_basic_execution" {
130+ role = aws_iam_role. lambda_iam_role . name
131+ policy_arn = data. aws_iam_policy . lambda_basic_execution_role_policy . arn
132+ }
133+
133134resource "aws_lambda_permission" "with_sns" {
134135 statement_id = " AllowExecutionFromSNS"
135136 action = " lambda:InvokeFunction"
@@ -138,10 +139,6 @@ resource "aws_lambda_permission" "with_sns" {
138139 source_arn = aws_sns_topic. MySNSTopic . arn
139140}
140141
141-
142-
143-
144-
145142// ---------------------------------------------------------
146143// Output
147144// ---------------------------------------------------------
You can’t perform that action at this time.
0 commit comments