Skip to content

Commit

Permalink
r/lambda_function: support nodejs 10.x runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
acburdine committed May 14, 2019
1 parent c4d48c0 commit 6d39f61
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions aws/resource_aws_lambda_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var validLambdaRuntimes = []string{
lambda.RuntimeNodejs43Edge,
lambda.RuntimeNodejs610,
lambda.RuntimeNodejs810,
lambda.RuntimeNodejs10X,
lambda.RuntimeProvided,
lambda.RuntimePython27,
lambda.RuntimePython36,
Expand Down
38 changes: 38 additions & 0 deletions aws/resource_aws_lambda_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,32 @@ func TestAccAWSLambdaFunction_runtimeValidation_NodeJs810(t *testing.T) {
})
}

func TestAccAWSLambdaFunction_runtimeValidation_NodeJs10x(t *testing.T) {
var conf lambda.GetFunctionOutput

rString := acctest.RandString(8)

funcName := fmt.Sprintf("tf_acc_lambda_func_runtime_valid_nodejs10x_%s", rString)
policyName := fmt.Sprintf("tf_acc_policy_lambda_func_runtime_valid_nodejs10x_%s", rString)
roleName := fmt.Sprintf("tf_acc_role_lambda_func_runtime_valid_nodejs10x_%s", rString)
sgName := fmt.Sprintf("tf_acc_sg_lambda_func_runtime_valid_nodejs10x_%s", rString)

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckLambdaFunctionDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSLambdaConfigNodeJs10xRuntime(funcName, policyName, roleName, sgName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAwsLambdaFunctionExists("aws_lambda_function.lambda_function_test", funcName, &conf),
resource.TestCheckResourceAttr("aws_lambda_function.lambda_function_test", "runtime", lambda.RuntimeNodejs10X),
),
},
},
})
}

func TestAccAWSLambdaFunction_runtimeValidation_python27(t *testing.T) {
var conf lambda.GetFunctionOutput

Expand Down Expand Up @@ -2160,6 +2186,18 @@ resource "aws_lambda_function" "lambda_function_test" {
`, funcName)
}

func testAccAWSLambdaConfigNodeJs10xRuntime(funcName, policyName, roleName, sgName string) string {
return fmt.Sprintf(baseAccAWSLambdaConfig(policyName, roleName, sgName)+`
resource "aws_lambda_function" "lambda_function_test" {
filename = "test-fixtures/lambdatest.zip"
function_name = "%s"
role = "${aws_iam_role.iam_for_lambda.arn}"
handler = "exports.example"
runtime = "nodejs10.x"
}
`, funcName)
}

func testAccAWSLambdaConfigPython27Runtime(funcName, policyName, roleName, sgName string) string {
return fmt.Sprintf(baseAccAWSLambdaConfig(policyName, roleName, sgName)+`
resource "aws_lambda_function" "lambda_function_test" {
Expand Down

0 comments on commit 6d39f61

Please sign in to comment.