Commit a96d7c18 authored by Milica Zivkov's avatar Milica Zivkov

Make it easier to upload Lambda package

parent d0afe586
......@@ -12,7 +12,7 @@ resource "aws_lambda_function" "lambda" {
timeout = "${var.timeout}"
s3_bucket = "${var.code_bucket}"
s3_key = "${var.package_name}"
s3_key = "${aws_s3_bucket_object.lambda_bucket_object.id}"
role = "${aws_iam_role.lambda_basic_exec_role.arn}"
......@@ -23,6 +23,12 @@ resource "aws_lambda_function" "lambda" {
}
}
resource "aws_s3_bucket_object" "lambda_bucket_object" {
bucket = "${var.code_bucket}"
key = "${var.package_name}"
source = "../${var.function_name}/dist/${var.package_name}"
}
resource "aws_iam_role" "lambda_basic_exec_role" {
name = "${var.function_name}_role"
assume_role_policy = "${data.aws_iam_policy_document.assume_role_policy_document.json}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment