Skip to content

Commit

Permalink
GH-6 Uncomment Lambda infra code now that image has been pushed to EC…
Browse files Browse the repository at this point in the history
…R registry
  • Loading branch information
blairnangle committed Nov 21, 2023
1 parent 2122e74 commit a78c226
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
26 changes: 13 additions & 13 deletions infra/cloudwatch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ resource "aws_cloudwatch_event_target" "nightly_cron_goodreads" {
arn = aws_lambda_function.goodreads.arn
}

#resource "aws_lambda_permission" "allow_cloudwatch_to_trigger_letterboxd" {
# statement_id = "AllowExecutionFromCloudWatch"
# action = "lambda:InvokeFunction"
# function_name = aws_lambda_function.letterboxd.function_name
# principal = "events.amazonaws.com"
# source_arn = aws_cloudwatch_event_rule.nightly_cron.arn
#}
#
#resource "aws_cloudwatch_event_target" "nightly_cron_letterboxd" {
# target_id = "nightly-cron-letterboxd"
# rule = aws_cloudwatch_event_rule.nightly_cron.name
# arn = aws_lambda_function.letterboxd.arn
#}
resource "aws_lambda_permission" "allow_cloudwatch_to_trigger_letterboxd" {
statement_id = "AllowExecutionFromCloudWatch"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.letterboxd.function_name
principal = "events.amazonaws.com"
source_arn = aws_cloudwatch_event_rule.nightly_cron.arn
}

resource "aws_cloudwatch_event_target" "nightly_cron_letterboxd" {
target_id = "nightly-cron-letterboxd"
rule = aws_cloudwatch_event_rule.nightly_cron.name
arn = aws_lambda_function.letterboxd.arn
}
34 changes: 17 additions & 17 deletions infra/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ resource "aws_iam_role_policy_attachment" "goodreads_logging" {
policy_arn = aws_iam_policy.lambda_logging.arn
}

#resource "aws_lambda_function" "letterboxd" {
# image_uri = "${aws_ecr_repository.letterboxd.repository_url}:latest"
# function_name = "letterboxd"
# role = aws_iam_role.letterboxd.arn
# package_type = "Image"
# timeout = 60
#}
#
#resource "aws_iam_role" "letterboxd" {
# name = "letterboxd"
# assume_role_policy = file("./templates/lambda-assume-role.json")
#}
#
#resource "aws_iam_role_policy_attachment" "letterboxd_logging" {
# role = aws_iam_role.letterboxd.name
# policy_arn = aws_iam_policy.lambda_logging.arn
#}
resource "aws_lambda_function" "letterboxd" {
image_uri = "${aws_ecr_repository.letterboxd.repository_url}:latest"
function_name = "letterboxd"
role = aws_iam_role.letterboxd.arn
package_type = "Image"
timeout = 60
}

resource "aws_iam_role" "letterboxd" {
name = "letterboxd"
assume_role_policy = file("./templates/lambda-assume-role.json")
}

resource "aws_iam_role_policy_attachment" "letterboxd_logging" {
role = aws_iam_role.letterboxd.name
policy_arn = aws_iam_policy.lambda_logging.arn
}

0 comments on commit a78c226

Please sign in to comment.