File tree Expand file tree Collapse file tree 4 files changed +10
-15
lines changed
examples/simple-lambda-with-deploy-test Expand file tree Collapse file tree 4 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,11 @@ This is done by:
18
18
## Usage
19
19
``` hcl
20
20
module "lambda_api" {
21
- source = "../../ "
21
+ source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v0.0.2 "
22
22
app_name = "my-lambda"
23
23
env = "dev"
24
24
codedeploy_service_role_arn = module.acs.power_builder_role.arn
25
- lambda_src_dir = "./src"
25
+ lambda_zip_file = "./src/lambda.zip "
26
26
handler = "index.handler"
27
27
runtime = "nodejs12.x"
28
28
hosted_zone = module.acs.route53_zone
@@ -69,7 +69,7 @@ module "lambda_api" {
69
69
| app_name | string | application name |
70
70
| env | string | application environment (e.g. dev, stg, prd) |
71
71
| 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. |
73
73
| handler | string | Lambda event handler |
74
74
| runtime | string | Lambda runtime |
75
75
| environment_variables | map(string) | A map that defines environment variables for the Lambda function. |
Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ module "acs" {
8
8
}
9
9
10
10
module "lambda_api" {
11
- source = " ../../"
11
+ // source = "../../"
12
+ source = " github.com/byu-oit/terraform-aws-lambda-api?ref=v0.0.2"
12
13
app_name = " my-lambda"
13
14
env = " dev"
14
15
codedeploy_service_role_arn = module. acs . power_builder_role . arn
15
- lambda_src_dir = " ./src"
16
+ lambda_zip_file = " ./src/lambda.zip "
16
17
handler = " index.handler"
17
18
runtime = " nodejs12.x"
18
19
hosted_zone = module. acs . route53_zone
Original file line number Diff line number Diff line change @@ -219,12 +219,6 @@ resource "aws_iam_role_policy_attachment" "lambda_policy_attach" {
219
219
role = aws_iam_role. iam_for_lambda . name
220
220
}
221
221
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
-
228
222
# TODO: the SG fails to destroy because the lambda's ENI is still using it.
229
223
resource "aws_security_group" "lambda_sg" {
230
224
name = " ${ local . long_name } -lambda-sg"
@@ -243,8 +237,8 @@ resource "aws_security_group" "lambda_sg" {
243
237
}
244
238
245
239
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 )
248
242
function_name = local. long_name
249
243
role = aws_iam_role. iam_for_lambda . arn
250
244
handler = var. handler
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ variable "codedeploy_service_role_arn" {
13
13
description = " ARN of the IAM Role for the CodeDeploy to use to initiate new deployments. (usually the PowerBuilder Role)"
14
14
}
15
15
16
- variable "lambda_src_dir " {
16
+ variable "lambda_zip_file " {
17
17
type = string
18
- description = " Directory that contains your lambda source code"
18
+ description = " File that contains your compiled or zipped source code. "
19
19
}
20
20
21
21
variable "handler" {
You can’t perform that action at this time.
0 commit comments