Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
Use a null_resource to zip the lambda source
Browse files Browse the repository at this point in the history
`files/rename_email_files_with_request_id.zip` is now created by a
`null_resource`. The resource is rebuilt when the source
(files/rename_email_files_with_request_id.py) is changed.
  • Loading branch information
gpeng committed Apr 25, 2016
1 parent acd62d1 commit 12fef94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,23 @@ resource "aws_iam_role_policy" "write_to_logs" {
policy = "${file("templates/write_to_logs_policy.json")}"
}

resource "aws_lambda_function" "rename_email_files_with_request_id"{
filename = "rename_email_files_with_request_id.zip"
resource "aws_lambda_function" "rename_email_files_with_request_id" {
depends_on = ["null_resource.build_rename_email_files_with_request_id"]
filename = "files/rename_email_files_with_request_id.zip"
function_name = "rename_email_files_with_request_id"
role = "${aws_iam_role.lambda_execute_and_write_to_email_alert_bucket.arn}"
handler = "rename_email_files_with_request_id.lambda_handler"
runtime = "python2.7"
source_code_hash = "${base64sha256(file("rename_email_files_with_request_id.zip"))}"
source_code_hash = "${base64sha256(file("files/rename_email_files_with_request_id.py"))}"
}

resource "null_resource" "build_rename_email_files_with_request_id" {
triggers {
source_code_hash = "${base64sha256(file("files/rename_email_files_with_request_id.py"))}"
}
provisioner "local-exec" {
command = "zip -j files/rename_email_files_with_request_id.zip files/rename_email_files_with_request_id.py"
}
}


Binary file not shown.

0 comments on commit 12fef94

Please sign in to comment.