Allow function-level vpc: false/null under strict config validation#422
Open
bburgalat-bcg wants to merge 2 commits into
Open
Allow function-level vpc: false/null under strict config validation#422bburgalat-bcg wants to merge 2 commits into
vpc: false/null under strict config validation#422bburgalat-bcg wants to merge 2 commits into
Conversation
Function VPC opt-out (`vpc: false` or `vpc: null`) is honored by the compile step (lib/plugins/aws/package/compile/functions.js), but the JSON schema only accepted an object. With v4's default `configValidationMode: error`, this was rejected with `vpc: must be object`, making it impossible to exclude a single function from `provider.vpc` under strict validation. Extend the function-level `vpc` schema to accept `false`/`null` in addition to the config object, matching the compile logic. Add a regression test asserting `vpc: false` yields no VpcConfig.
Reword the comment on the function `vpc` schema to make clear the change is on the function-level field (opting a function out of the provider VPC), not on `provider.vpc` itself.
GrahamCampbell
self-requested a review
July 21, 2026 14:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #421.
Problem
Under v4's default
configValidationMode: error, a function-level VPC opt-out (vpc: falseorvpc: null) is rejected:The opt-out is still honored by the compile step —
lib/plugins/aws/package/compile/functions.jschecksfunctionObject.vpc !== null && functionObject.vpc !== false— but the function-levelvpcschema only accepts an object, so strict validation blocks it. This removes the only way to exclude a single function fromprovider.vpc(false,nulland{}are all rejected). It worked in v3 only because config validation defaulted towarn.Fix
Extend the function-level
vpcschema to acceptfalse/nullin addition to the config object, matching the compile logic. The provider-levelvpcschema is left unchanged.Test
Added a regression test asserting
vpc: falseyields noVpcConfig(mirrors the existingvpc: nullcase). All vpc tests in the functions compile suite pass (10/10).