You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs(ec2): explain subnet AZ filtering with unresolved tokens - #39283
SubnetSelection.availabilityZones filters during synthesis. Literal AZ names cannot match subnet AZs represented by unresolved tokens, even when a VPC construct is passed between stacks.
Description of changes
Document the synthesis-time limitation on SubnetSelection.availabilityZones, refine the README explanation, and show a new VPC configured with explicit AZ names before filtering.
Describe any new or updated permissions being added
None. This is a documentation-only change.
Description of how you validated changes
Built aws-cdk-lib using the dependency versions pinned by the current main branch.
Compiled and translated the new README example with jsii-rosetta using the repository fixture.
Executed the exact README example and confirmed that only the us-east-1a isolated subnet is selected. Also reproduced the empty selection when literal names are compared with unresolved subnet AZs and checked a cross-stack VPC reference.
Ran jest aws-ec2/test/vpc.test.ts --runInBand --coverage=false (187 tests passed) and ESLint on vpc.ts.
Verified that the JSDoc change leaves emitted JavaScript unchanged.
Reviewed the documentation against the implementation and checked git diff --check.
This PR is a documentation-only clarification in the aws-ec2 module explaining why vpc.selectSubnets({ availabilityZones: [...] }) returns an empty selection when a VPC's availability zones are unresolved tokens at synthesis time, and how to avoid it by supplying explicit AZ names. It touches two files: a four-line paragraph added to the JSDoc of the pre-existing SubnetSelection.availabilityZones property in vpc.ts, and a rewritten bullet plus a runnable example in README.md.
The change adds no new public surface and alters no API shape, signature, default, or runtime behavior. The documented guidance is accurate against the implementation, and the README example is a valid VPC configuration (natGateways: 0 with a single PRIVATE_ISOLATED subnet group) that compiles. No issues found on this change.
🔴 0 blocking · 🟡 0 recommended · ⚪ 0 optional
Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews.
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
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.
Issue # (if applicable)
Closes #27540.
Reason for this change
SubnetSelection.availabilityZones filters during synthesis. Literal AZ names cannot match subnet AZs represented by unresolved tokens, even when a VPC construct is passed between stacks.
Description of changes
Document the synthesis-time limitation on SubnetSelection.availabilityZones, refine the README explanation, and show a new VPC configured with explicit AZ names before filtering.
Describe any new or updated permissions being added
None. This is a documentation-only change.
Description of how you validated changes
aws-cdk-libusing the dependency versions pinned by the current main branch.jest aws-ec2/test/vpc.test.ts --runInBand --coverage=false(187 tests passed) and ESLint onvpc.ts.git diff --check.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license