cdk-factory 0.15.22__py3-none-any.whl → 0.15.23__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -112,34 +112,46 @@ class LoadBalancerStack(IStack, EnhancedSsmParameterMixin):
112
112
  # Get subnets
113
113
  subnets = self._get_subnets()
114
114
 
115
+ # Prepare vpc_subnets parameter
116
+ # If subnets is None, we'll handle it via escape hatch after creation
117
+ vpc_subnets_param = ec2.SubnetSelection(subnets=subnets) if subnets else None
118
+
115
119
  # Create the Load Balancer based on type
116
120
  if self.lb_config.type == "APPLICATION":
117
- load_balancer = elbv2.ApplicationLoadBalancer(
118
- self,
119
- lb_name,
120
- load_balancer_name=lb_name,
121
- vpc=self.vpc,
122
- internet_facing=self.lb_config.internet_facing,
123
- security_group=(
121
+ # When vpc_subnets is None and we have token-based subnet_ids,
122
+ # we need to create the ALB without vpc_subnets to avoid VPC subnet lookup errors
123
+ alb_props = {
124
+ "load_balancer_name": lb_name,
125
+ "vpc": self.vpc,
126
+ "internet_facing": self.lb_config.internet_facing,
127
+ "security_group": (
124
128
  security_groups[0]
125
129
  if security_groups and len(security_groups) > 0
126
130
  else None
127
131
  ),
128
- deletion_protection=self.lb_config.deletion_protection,
129
- idle_timeout=cdk.Duration.seconds(self.lb_config.idle_timeout),
130
- http2_enabled=self.lb_config.http2_enabled,
131
- vpc_subnets=ec2.SubnetSelection(subnets=subnets) if subnets else None,
132
- )
132
+ "deletion_protection": self.lb_config.deletion_protection,
133
+ "idle_timeout": cdk.Duration.seconds(self.lb_config.idle_timeout),
134
+ "http2_enabled": self.lb_config.http2_enabled,
135
+ }
136
+
137
+ # Only add vpc_subnets if we have concrete subnet objects
138
+ if vpc_subnets_param:
139
+ alb_props["vpc_subnets"] = vpc_subnets_param
140
+
141
+ load_balancer = elbv2.ApplicationLoadBalancer(self, lb_name, **alb_props)
133
142
  else: # NETWORK
134
- load_balancer = elbv2.NetworkLoadBalancer(
135
- self,
136
- lb_name,
137
- load_balancer_name=lb_name,
138
- vpc=self.vpc,
139
- internet_facing=self.lb_config.internet_facing,
140
- deletion_protection=self.lb_config.deletion_protection,
141
- vpc_subnets=ec2.SubnetSelection(subnets=subnets) if subnets else None,
142
- )
143
+ nlb_props = {
144
+ "load_balancer_name": lb_name,
145
+ "vpc": self.vpc,
146
+ "internet_facing": self.lb_config.internet_facing,
147
+ "deletion_protection": self.lb_config.deletion_protection,
148
+ }
149
+
150
+ # Only add vpc_subnets if we have concrete subnet objects
151
+ if vpc_subnets_param:
152
+ nlb_props["vpc_subnets"] = vpc_subnets_param
153
+
154
+ load_balancer = elbv2.NetworkLoadBalancer(self, lb_name, **nlb_props)
143
155
 
144
156
  # If subnets is None, check if we have SSM-imported subnet_ids as a token
145
157
  # We need to use Fn.Split to convert the comma-separated string to an array
@@ -173,9 +185,16 @@ class LoadBalancerStack(IStack, EnhancedSsmParameterMixin):
173
185
  # Build VPC attributes
174
186
  vpc_attrs = {
175
187
  "vpc_id": vpc_id,
176
- "availability_zones": ["us-east-1a", "us-east-1b"]
188
+ "availability_zones": ["us-east-1a", "us-east-1b"],
177
189
  }
178
190
 
191
+ # If we have subnet_ids from SSM, provide dummy public subnets
192
+ # The actual subnets will be set via CloudFormation escape hatch
193
+ if "subnet_ids" in self.ssm_imported_values:
194
+ # Provide dummy subnet IDs - these will be overridden by the escape hatch
195
+ # We need at least one dummy subnet per AZ to satisfy CDK's validation
196
+ vpc_attrs["public_subnet_ids"] = ["subnet-dummy1", "subnet-dummy2"]
197
+
179
198
  # Use from_vpc_attributes() instead of from_lookup() because SSM imports return tokens
180
199
  self._vpc = ec2.Vpc.from_vpc_attributes(self, "VPC", **vpc_attrs)
181
200
  elif self.lb_config.vpc_id:
cdk_factory/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.15.22"
1
+ __version__ = "0.15.23"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdk_factory
3
- Version: 0.15.22
3
+ Version: 0.15.23
4
4
  Summary: CDK Factory. A QuickStarter and best practices setup for CDK projects
5
5
  Author-email: Eric Wilson <eric.wilson@geekcafe.com>
6
6
  License: MIT License
@@ -2,7 +2,7 @@ cdk_factory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  cdk_factory/app.py,sha256=RnX0-pwdTAPAdKJK_j13Zl8anf9zYKBwboR0KA8K8xM,10346
3
3
  cdk_factory/cdk.json,sha256=SKZKhJ2PBpFH78j-F8S3VDYW-lf76--Q2I3ON-ZIQfw,3106
4
4
  cdk_factory/cli.py,sha256=FGbCTS5dYCNsfp-etshzvFlGDCjC28r6rtzYbe7KoHI,6407
5
- cdk_factory/version.py,sha256=shv1DnYQStFbMP5tTfMYOU43hXngTdA0D45wB2TtIY4,24
5
+ cdk_factory/version.py,sha256=7op-jiE3Ez13LGI3TOZuMVElwwRvXglYAxFNKJgv7P8,24
6
6
  cdk_factory/builds/README.md,sha256=9BBWd7bXpyKdMU_g2UljhQwrC9i5O_Tvkb6oPvndoZk,90
7
7
  cdk_factory/commands/command_loader.py,sha256=QbLquuP_AdxtlxlDy-2IWCQ6D-7qa58aphnDPtp_uTs,3744
8
8
  cdk_factory/configurations/base_config.py,sha256=JKjhNsy0RCUZy1s8n5D_aXXI-upR9izaLtCTfKYiV9k,9624
@@ -97,7 +97,7 @@ cdk_factory/stack_library/ecs/ecs_service_stack.py,sha256=c6K3BjlXyldr8ikvEhfC9C
97
97
  cdk_factory/stack_library/lambda_edge/__init__.py,sha256=ByBJ_CWdc4UtTmFBZH-6pzBMNkjkdtE65AmnB0Fs6lM,156
98
98
  cdk_factory/stack_library/lambda_edge/lambda_edge_stack.py,sha256=CdId_1kcZmYr1lLI9AD3-KqtE6voC3641PIloJmWiNI,16414
99
99
  cdk_factory/stack_library/load_balancer/__init__.py,sha256=wZpKw2OecLJGdF5mPayCYAEhu2H3c2gJFFIxwXftGDU,52
100
- cdk_factory/stack_library/load_balancer/load_balancer_stack.py,sha256=fgp2s3DjP1fIRZT2PaxQVPrL4MGILML3ovcreEdmFlo,29651
100
+ cdk_factory/stack_library/load_balancer/load_balancer_stack.py,sha256=5JqBUJCeHjhzJFTBoh63gpCzQjYb5vcAJwC5U7MLhCk,30762
101
101
  cdk_factory/stack_library/monitoring/__init__.py,sha256=k1G_KDx47Aw0UugaL99PN_TKlyLK4nkJVApCaAK7GJg,153
102
102
  cdk_factory/stack_library/monitoring/monitoring_stack.py,sha256=N_1YvEXE7fboH_S3kv_dSKZsufxMuPdFMjGzlNFpuSo,19283
103
103
  cdk_factory/stack_library/rds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -129,8 +129,8 @@ cdk_factory/utilities/lambda_function_utilities.py,sha256=S1GvBsY_q2cyUiaud3HORJ
129
129
  cdk_factory/utilities/os_execute.py,sha256=5Op0LY_8Y-pUm04y1k8MTpNrmQvcLmQHPQITEP7EuSU,1019
130
130
  cdk_factory/utils/api_gateway_utilities.py,sha256=If7Xu5s_UxmuV-kL3JkXxPLBdSVUKoLtohm0IUFoiV8,4378
131
131
  cdk_factory/workload/workload_factory.py,sha256=yDI3cRhVI5ELNDcJPLpk9UY54Uind1xQoV3spzT4z7E,6068
132
- cdk_factory-0.15.22.dist-info/METADATA,sha256=MIXVvmQIOmO3HcrhZrF7Cj9c9t-og0x9Av89UN4qfWo,2452
133
- cdk_factory-0.15.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
134
- cdk_factory-0.15.22.dist-info/entry_points.txt,sha256=S1DPe0ORcdiwEALMN_WIo3UQrW_g4YdQCLEsc_b0Swg,53
135
- cdk_factory-0.15.22.dist-info/licenses/LICENSE,sha256=NOtdOeLwg2il_XBJdXUPFPX8JlV4dqTdDGAd2-khxT8,1066
136
- cdk_factory-0.15.22.dist-info/RECORD,,
132
+ cdk_factory-0.15.23.dist-info/METADATA,sha256=TJZXugMYlzyNorvDOrQVTCY8OGPImjY97iso0ro2rhQ,2452
133
+ cdk_factory-0.15.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
134
+ cdk_factory-0.15.23.dist-info/entry_points.txt,sha256=S1DPe0ORcdiwEALMN_WIo3UQrW_g4YdQCLEsc_b0Swg,53
135
+ cdk_factory-0.15.23.dist-info/licenses/LICENSE,sha256=NOtdOeLwg2il_XBJdXUPFPX8JlV4dqTdDGAd2-khxT8,1066
136
+ cdk_factory-0.15.23.dist-info/RECORD,,