From 0f1c970281cf1891f51fef7d3fbff4289aad7f3e Mon Sep 17 00:00:00 2001 From: Kyle Laker Date: Fri, 12 Aug 2022 01:02:26 -0400 Subject: [PATCH] docs(lambda): Document recent changes to `vpcSubnets` property Recently, the Function construct was changed to raise an error if `vpcSubnets` was specified but `vpc` wasn't; however, this change was not properly reflected in the documentation for the function. The change itself was made in #21369. Closes #21565 --- packages/@aws-cdk/aws-lambda/lib/function.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda/lib/function.ts b/packages/@aws-cdk/aws-lambda/lib/function.ts index 2f14b31b3b9d2..6c764d4fcab37 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function.ts @@ -133,6 +133,7 @@ export interface FunctionOptions extends EventInvokeConfigOptions { * VPC network to place Lambda network interfaces * * Specify this if the Lambda function needs to access resources in a VPC. + * This is required when `vpcSubnets` is specified. * * @default - Function is not placed within a VPC. */ @@ -141,8 +142,11 @@ export interface FunctionOptions extends EventInvokeConfigOptions { /** * Where to place the network interfaces within the VPC. * - * Only used if 'vpc' is supplied. Note: internet access for Lambdas - * requires a NAT gateway, so picking Public subnets is not allowed. + * This requires `vpc` to be specified in order for interfaces to actually be + * placed in the subnets. If `vpc` is not specify, this will raise an error. + * + * Note: Internet access for Lambda Functions requires a NAT Gateway, so picking + * public subnets is not allowed (unless `allowPublicSubnet` is set to `true`). * * @default - the Vpc default strategy if not specified */