Skip to content

Commit 77f5ec3

Browse files
authored
Merge pull request #4 from non-existing-organization/feature/parameters-runtime-lambda-code
allow to pass any function script and runtime
2 parents e0ef6ea + 78dc734 commit 77f5ec3

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

USAGE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ No requirements.
88

99
| Name | Version |
1010
|------|---------|
11-
| archive | n/a |
1211
| aws | n/a |
1312

1413
## Inputs
@@ -21,9 +20,11 @@ No requirements.
2120
| function\_name | Name of the aws lambda function | `string` | n/a | yes |
2221
| handler | Handler for the aws lambda function, the structure should be the following --> filename.mainfunction | `string` | n/a | yes |
2322
| lambda\_role\_name | Name of the aws lambda execution role | `string` | n/a | yes |
23+
| lambda\_runtime | Lambda runtime i.e <python3.8> | `string` | `"python3.8"` | no |
2424
| output\_path | The path and name of the resulting zip file | `string` | n/a | yes |
2525
| region | n/a | `string` | `"us-east-1"` | no |
2626
| schedule\_expression | Cloudwatch rule rate expression for how frequent you want the lambda function to run | `string` | n/a | yes |
27+
| source\_code\_hash | hash of the current zip file, changes in the function code will produce an update of the lambda function | `string` | n/a | yes |
2728
| source\_file | The path in your filesystem where your script is located | `string` | n/a | yes |
2829
| table\_name | Name of the DynamoDB table | `string` | n/a | yes |
2930

data.tf

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
data "aws_caller_identity" "current" {}
2-
3-
data "archive_file" "lambda_zip" {
4-
type = "zip"
5-
source_file = var.source_file
6-
output_path = var.output_path
7-
}
1+
data "aws_caller_identity" "current" {}

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ locals {
88
resource "aws_lambda_function" "check_sgs" {
99
filename = var.output_path
1010
function_name = var.function_name
11-
source_code_hash = data.archive_file.lambda_zip.output_base64sha256
11+
source_code_hash = var.source_code_hash
1212
role = aws_iam_role.iam_for_lambda.arn
1313
handler = var.handler
14-
runtime = "python3.8"
14+
runtime = var.lambda_runtime
1515
timeout = 10
1616

1717
environment {

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ variable "function_name" {
1818
description = "Name of the aws lambda function"
1919
}
2020

21+
variable "lambda_runtime" {
22+
type = string
23+
description = "Lambda runtime i.e <python3.8>"
24+
default = "python3.8"
25+
}
26+
27+
variable "source_code_hash" {
28+
type = string
29+
description = "hash of the current zip file, changes in the function code will produce an update of the lambda function"
30+
}
31+
2132
variable "table_name" {
2233
type = string
2334
description = "Name of the DynamoDB table"

0 commit comments

Comments
 (0)