Skip to content

Commit

Permalink
Updated lambda test
Browse files Browse the repository at this point in the history
  • Loading branch information
denis256 committed May 23, 2024
1 parent b8a4f98 commit b18a248
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/terraform-aws-lambda-example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "aws_lambda_function" "lambda" {
source_code_hash = data.archive_file.zip.output_base64sha256
function_name = var.function_name
role = aws_iam_role.lambda.arn
handler = "lambda"
handler = "bootstrap"
runtime = "provided.al2023"
}

Expand Down
Binary file modified examples/terraform-aws-lambda-example/src/bootstrap
Binary file not shown.
5 changes: 4 additions & 1 deletion examples/terraform-aws-lambda-example/src/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ type Event struct {
}

// Fails if ShouldFail is `true`, otherwise echos the input.
func HandleRequest(ctx context.Context, evnt Event) (string, error) {
func HandleRequest(ctx context.Context, evnt *Event) (string, error) {
if evnt == nil {
return "", fmt.Errorf("received nil event")
}
if evnt.ShouldFail {
return "", fmt.Errorf("Failed to handle %#v", evnt)
}
Expand Down
2 changes: 1 addition & 1 deletion test/terraform_aws_lambda_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestTerraformAwsLambdaExample(t *testing.T) {
assert.Contains(t, string(functionError.Payload), "Failed to handle")
}

// Annother example of how to test the Terraform module in
// Another example of how to test the Terraform module in
// examples/terraform-aws-lambda-example using Terratest, this time with
// the aws.InvokeFunctionWithParams.
func TestTerraformAwsLambdaWithParamsExample(t *testing.T) {
Expand Down

0 comments on commit b18a248

Please sign in to comment.