Skip to content

Commit b735097

Browse files
authored
fix: global nested stack (#30)
* fix: global nested stack * fix: global nested stack
1 parent d5c3c7c commit b735097

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
### [0.0.21]
6+
7+
#### Added
8+
- **Configurable route table entry naming for subnet routes**
9+
- Added `routeTableStringFormat` to `ISubnetsProps` to control the logical ID format for routes created via `subnet.addRoute`.
10+
- When `routeTableStringFormat` is `true`, route logical IDs follow the descriptive format `${subnetGroupName}-${routeName-or-sanitized-destinationCidrBlock}-Route`.
11+
- When `routeTableStringFormat` is `false` or unset, the previous `${subnetGroupName}${routeIndex}RouteEntry` naming is preserved for backwards compatibility.
12+
13+
14+
### [0.0.22]
15+
16+
#### Added
17+
- **Global nested subnet stacks configuration**
18+
- Added a global `useNestedStacks` option to `VPCProps` to create subnets via `SubnetStack` by default.
19+
- Updated `Network.createSubnet` (`src/constructs/network.ts`) to choose between nested (`SubnetStack`) and inline subnet/NACL/route creation based on this flag.
20+
- A per-subnet `useNestedStacks` value in `ISubnetsProps` overrides the global setting, allowing fine-grained control per subnet group.

src/constructs/network.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export class Network extends Construct {
123123
constructor(scope: Construct, id: string, props: VPCProps) {
124124
super(scope, id);
125125
this.vpc = new ec2.Vpc(this, 'VPC', props.vpc);
126+
const useNestedStacks = props.useNestedStacks ?? false;
126127
if (props.peeringConfigs) {
127128
const convertPeeringConfig: Map<string, PeeringConfig> = ObjToStrMap(props.peeringConfigs);
128129
convertPeeringConfig.forEach((createVpcPeering, key) => {
@@ -141,7 +142,7 @@ export class Network extends Construct {
141142
});
142143
}
143144
props.subnets.forEach((subnetProps) => {
144-
let subnet = this.createSubnet(subnetProps, this.vpc, this.peeringConnectionIds);
145+
let subnet = this.createSubnet(subnetProps, this.vpc, this.peeringConnectionIds, useNestedStacks);
145146
this.subnets[subnetProps.subnetGroupName] = subnet;
146147
subnet.forEach((sb) => {
147148
if (sb instanceof ec2.PublicSubnet) {

0 commit comments

Comments
 (0)