feat(ec2): allow filtering out exhausted subnets during subnet selection #8311
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.
When selecting subnets using
SubnetSelection
it's useful to be able to filter out those subnets with 0 available IP addresses (IP "exhausted" subnets) that may exist in subnet groups where the remaining subnets have adequate IP space. In doing so we can avoid trying to use these subnets.For example a DBCluster that may try to create an instance in an exhausted Subnet during a scaling event.
As I said in #8310, I'm quite new to both the CDK codebase and Typescript, so I am looking at this as a learning experience. Apologies in advance for any egregious sins I've committed.
I've added both a simple unit test and integration tests, which alongside the other tests, should validate that this is not a breaking change, and show successful filtering of Subnets with 0 available IP addresses when the appropriate SubnetSelection option is supplied.
Closes #8310.
TODO:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license