-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot extend subnet groups properly after vpc is deployed #2087
Comments
Subnet groups will be a confusing name, since we internally already refer to the current subnets as subnet "groups". Is it not sufficient to add the following to a SubnetConfiguration options: {
/** @default false */
reserved?: boolean;
} The effect of setting this to |
Hmm that would be simpler to implement but the downside i see is that when adding a new application/database subnet you have to remember to remove a reserved subnet. But maybe that could be handled by the client code itself instead of by cdk... I ll see if I find some time to implement this tonight and will update the PR ;) |
@rix0rrr Would you prefer having another subnet type: |
Updated PR with requested changes. |
Typically there are multiple subnets that must be allocated in groups. However, at the moment, it is not possible to have groups of subnets - any attempt to do so will result in configuration that is not extensible. To explain this better, consider the use-case below:
As a use-case, here is a simplification of the scenario we have in our organisation. At the moment we provide 3 business products and each of these has 2 types of subnets:
As the organisation grows, new business products are introduced and hence we may be asked to add other subnets in the future. When the VPC is initially created, there is no way to anticipate which products will be introduced later on. We can however assume that a maximum of 8 products is a good limit for a number of years to come.
Using the current capabilities of VpcNetwork, we define our requirements (with 3 products) as follows:
Later on, when the organisation starts providing a new product, we would need to add more subnets, changing the configuration as follows:
However, checking the cdk diff we get the following changes:
This basically means that a number of subnets that are already in production will need to be renumbered. IP renumbering usually is not desirable and typically entirely not possible for applications that are already in production.
In order to make such changes possible, I propose a (non-breaking) change to subnetConfiguration in VpcNetworkProps. I propose the introduction of SubnetGroups. A SubnetGroup allows pre-allocating a block of subnets for future use. In the example given above, we can "pre-allocate" 8 subnets in each subnetGroup and this ensures that adding more subnets to each group in the future would not cause an IP renumbering.
For the same example given above, I propose the following configuration:
Note that the Public subnet is left outside any group to point out that this is a non-breaking change. All configurations defined so far will keep working. However, the
subnetConfiguration
property inVpcNetworkProps
now can also accept SubnetGroups as shown above. Above, we have 2 subnet groups each pre-allocating a block of 8 subnets (specified bymaxSubnets
).The expected cdk diff for the same addition of 'ApplicationD' and 'DatabaseD' subnets is then given below:
I have a working patch for the changes proposed. However, I wanted to discuss this with you and gather feedback before opening a pull request ;)
The text was updated successfully, but these errors were encountered: