Skip to content

Commit 31c45f6

Browse files
authored
Merge pull request #2 from byu-oit/feature/jar-support
feature/jar-support -> master
2 parents b2bc692 + c644880 commit 31c45f6

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ This is done by:
1818
## Usage
1919
```hcl
2020
module "lambda_api" {
21-
source = "../../"
21+
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v0.0.2"
2222
app_name = "my-lambda"
2323
env = "dev"
2424
codedeploy_service_role_arn = module.acs.power_builder_role.arn
25-
lambda_src_dir = "./src"
25+
lambda_zip_file = "./src/lambda.zip"
2626
handler = "index.handler"
2727
runtime = "nodejs12.x"
2828
hosted_zone = module.acs.route53_zone
@@ -69,7 +69,7 @@ module "lambda_api" {
6969
| app_name | string | application name |
7070
| env | string | application environment (e.g. dev, stg, prd) |
7171
| codedeploy_service_role_arn | string | ARN of the IAM Role for the CodeDeploy to use to initiate new deployments. (usually the PowerBuilder Role) |
72-
| lambda_src_dir | string | Directory that contains your lambda source code |
72+
| lambda_zip_file | string | File that contains your compiled or zipped source code. |
7373
| handler | string | Lambda event handler |
7474
| runtime | string | Lambda runtime |
7575
| environment_variables | map(string) | A map that defines environment variables for the Lambda function. |

examples/simple-lambda-with-deploy-test/example.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ module "acs" {
88
}
99

1010
module "lambda_api" {
11-
source = "../../"
11+
// source = "../../"
12+
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v0.0.2"
1213
app_name = "my-lambda"
1314
env = "dev"
1415
codedeploy_service_role_arn = module.acs.power_builder_role.arn
15-
lambda_src_dir = "./src"
16+
lambda_zip_file = "./src/lambda.zip"
1617
handler = "index.handler"
1718
runtime = "nodejs12.x"
1819
hosted_zone = module.acs.route53_zone

main.tf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,6 @@ resource "aws_iam_role_policy_attachment" "lambda_policy_attach" {
219219
role = aws_iam_role.iam_for_lambda.name
220220
}
221221

222-
data "archive_file" "cleanup_lambda_zip" {
223-
source_dir = var.lambda_src_dir
224-
output_path = "lambda_function_payload.zip"
225-
type = "zip"
226-
}
227-
228222
# TODO: the SG fails to destroy because the lambda's ENI is still using it.
229223
resource "aws_security_group" "lambda_sg" {
230224
name = "${local.long_name}-lambda-sg"
@@ -243,8 +237,8 @@ resource "aws_security_group" "lambda_sg" {
243237
}
244238

245239
resource "aws_lambda_function" "api_lambda" {
246-
filename = data.archive_file.cleanup_lambda_zip.output_path
247-
source_code_hash = data.archive_file.cleanup_lambda_zip.output_base64sha256
240+
filename = var.lambda_zip_file
241+
source_code_hash = filebase64sha256(var.lambda_zip_file)
248242
function_name = local.long_name
249243
role = aws_iam_role.iam_for_lambda.arn
250244
handler = var.handler

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ variable "codedeploy_service_role_arn" {
1313
description = "ARN of the IAM Role for the CodeDeploy to use to initiate new deployments. (usually the PowerBuilder Role)"
1414
}
1515

16-
variable "lambda_src_dir" {
16+
variable "lambda_zip_file" {
1717
type = string
18-
description = "Directory that contains your lambda source code"
18+
description = "File that contains your compiled or zipped source code."
1919
}
2020

2121
variable "handler" {

0 commit comments

Comments
 (0)