0

I am deploying the AWS resources using GitHub Actions and I am using terraform to create resources.

I have given the required Assume and IAM policy to the GitHub repo to deploy the resources.

One of my use cases is, that I need a cloud watch event rule which triggers the lambda every 1 hr. The Cloud watch event rule and lambda have been created successfully.

But, I got Error: Error reading new Lambda permissions: AccessDeniedException: error in the below statement during deployment.

Which IAM policy needs to add to execute the above statement.

resource "aws_lambda_permission" "allow-cloudwatch-lambda-execute" {
  statement_id  = "AllowExecutionFromCloudWatch"
  action        = "lambda:InvokeFunction"
  function_name = aws_lambda_function.lambda.function_name
  principal     = "events.amazonaws.com"
  source_arn    = aws_cloudwatch_event_rule.lambda-clodwatch-event-rule.arn
}
Ganesan C
  • 269
  • 1
  • 3
  • 9
  • Can you add the EventBridge rule and Lambda function code to the question? Also, is that the entire error output? – Marko E Jul 21 '22 at 19:01
  • The rest of the error should show which action is not allowed by the current identity executing terraform. – theherk Jul 21 '22 at 19:29

0 Answers0