@@ -39,7 +39,9 @@ class DeploymentConfig:
3939
4040 # Templates
4141 template_bucket : Optional [str ] = None # S3 bucket for CloudFormation templates
42- template_prefix : Optional [str ] = None # Local path prefix for template files (e.g., "test/fixtures/stable")
42+ template_prefix : Optional [str ] = (
43+ None # Local path prefix for template files (e.g., "test/fixtures/stable")
44+ )
4345 iam_template_url : Optional [str ] = None
4446 app_template_url : Optional [str ] = None
4547
@@ -113,14 +115,25 @@ def from_config_file(cls, config_path: Path, **overrides: Any) -> "DeploymentCon
113115 template_prefix = config .get ("template_prefix" ), # Optional template path prefix
114116 # Optional authentication (from overrides or environment)
115117 google_client_id = overrides .get ("google_client_id" ) or os .getenv ("GOOGLE_CLIENT_ID" ),
116- google_client_secret = overrides .get ("google_client_secret" ) or os .getenv ("GOOGLE_CLIENT_SECRET" ),
118+ google_client_secret = overrides .get ("google_client_secret" )
119+ or os .getenv ("GOOGLE_CLIENT_SECRET" ),
117120 okta_base_url = overrides .get ("okta_base_url" ) or os .getenv ("OKTA_BASE_URL" ),
118121 okta_client_id = overrides .get ("okta_client_id" ) or os .getenv ("OKTA_CLIENT_ID" ),
119- okta_client_secret = overrides .get ("okta_client_secret" ) or os .getenv ("OKTA_CLIENT_SECRET" ),
122+ okta_client_secret = overrides .get ("okta_client_secret" )
123+ or os .getenv ("OKTA_CLIENT_SECRET" ),
120124 ** {
121125 k : v
122126 for k , v in overrides .items ()
123- if k not in ["name" , "pattern" , "google_client_id" , "google_client_secret" , "okta_base_url" , "okta_client_id" , "okta_client_secret" ]
127+ if k
128+ not in [
129+ "name" ,
130+ "pattern" ,
131+ "google_client_id" ,
132+ "google_client_secret" ,
133+ "okta_base_url" ,
134+ "okta_client_id" ,
135+ "okta_client_secret" ,
136+ ]
124137 },
125138 )
126139
@@ -150,9 +163,7 @@ def _select_vpc(vpcs: List[Dict[str, Any]]) -> Dict[str, Any]:
150163 raise ValueError ("No suitable VPC found" )
151164
152165 @staticmethod
153- def _select_subnets (
154- subnets : List [Dict [str , Any ]], vpc_id : str
155- ) -> List [Dict [str , Any ]]:
166+ def _select_subnets (subnets : List [Dict [str , Any ]], vpc_id : str ) -> List [Dict [str , Any ]]:
156167 """Select public subnets in the VPC (need at least 2).
157168
158169 Args:
@@ -166,15 +177,11 @@ def _select_subnets(
166177 ValueError: If fewer than 2 public subnets found
167178 """
168179 public_subnets = [
169- s
170- for s in subnets
171- if s ["vpc_id" ] == vpc_id and s ["classification" ] == "public"
180+ s for s in subnets if s ["vpc_id" ] == vpc_id and s ["classification" ] == "public"
172181 ]
173182
174183 if len (public_subnets ) < 2 :
175- raise ValueError (
176- f"Need at least 2 public subnets, found { len (public_subnets )} "
177- )
184+ raise ValueError (f"Need at least 2 public subnets, found { len (public_subnets )} " )
178185
179186 return public_subnets [:2 ] # Return first 2
180187
@@ -194,21 +201,15 @@ def _select_security_groups(
194201 Raises:
195202 ValueError: If no suitable security groups found
196203 """
197- sgs = [
198- sg
199- for sg in security_groups
200- if sg ["vpc_id" ] == vpc_id and sg .get ("in_use" , False )
201- ]
204+ sgs = [sg for sg in security_groups if sg ["vpc_id" ] == vpc_id and sg .get ("in_use" , False )]
202205
203206 if not sgs :
204207 raise ValueError (f"No suitable security groups found in VPC { vpc_id } " )
205208
206209 return sgs [:3 ] # Return up to 3
207210
208211 @staticmethod
209- def _select_certificate (
210- certificates : List [Dict [str , Any ]], domain : str
211- ) -> Dict [str , Any ]:
212+ def _select_certificate (certificates : List [Dict [str , Any ]], domain : str ) -> Dict [str , Any ]:
212213 """Select certificate matching domain.
213214
214215 Args:
@@ -229,9 +230,7 @@ def _select_certificate(
229230 raise ValueError (f"No valid certificate found for domain { domain } " )
230231
231232 @staticmethod
232- def _select_route53_zone (
233- zones : List [Dict [str , Any ]], domain : str
234- ) -> Dict [str , Any ]:
233+ def _select_route53_zone (zones : List [Dict [str , Any ]], domain : str ) -> Dict [str , Any ]:
235234 """Select Route53 zone matching domain.
236235
237236 Args:
@@ -279,20 +278,24 @@ def get_optional_cfn_parameters(self) -> Dict[str, str]:
279278
280279 # Google OAuth (only if configured)
281280 if self .google_client_secret :
282- params .update ({
283- "GoogleAuth" : "Enabled" ,
284- "GoogleClientId" : self .google_client_id or "" ,
285- "GoogleClientSecret" : self .google_client_secret ,
286- })
281+ params .update (
282+ {
283+ "GoogleAuth" : "Enabled" ,
284+ "GoogleClientId" : self .google_client_id or "" ,
285+ "GoogleClientSecret" : self .google_client_secret ,
286+ }
287+ )
287288
288289 # Okta OAuth (only if configured)
289290 if self .okta_client_secret :
290- params .update ({
291- "OktaAuth" : "Enabled" ,
292- "OktaBaseUrl" : self .okta_base_url or "" ,
293- "OktaClientId" : self .okta_client_id or "" ,
294- "OktaClientSecret" : self .okta_client_secret ,
295- })
291+ params .update (
292+ {
293+ "OktaAuth" : "Enabled" ,
294+ "OktaBaseUrl" : self .okta_base_url or "" ,
295+ "OktaClientId" : self .okta_client_id or "" ,
296+ "OktaClientSecret" : self .okta_client_secret ,
297+ }
298+ )
296299
297300 return params
298301
@@ -311,32 +314,28 @@ def get_terraform_infrastructure_config(self) -> Dict[str, Any]:
311314 config = {
312315 "name" : self .deployment_name ,
313316 "template_file" : self .get_template_file_path (),
314-
315317 # Network configuration
316318 "create_new_vpc" : False , # Use existing VPC from config
317319 "vpc_id" : self .vpc_id ,
318- "intra_subnets" : self ._get_intra_subnets (), # For DB & ES
319- "private_subnets" : self ._get_private_subnets (), # For app
320- "public_subnets" : self .subnet_ids , # For ALB
320+ "intra_subnets" : self ._get_intra_subnets (), # For DB & ES
321+ "private_subnets" : self ._get_private_subnets (), # For app
322+ "public_subnets" : self .subnet_ids , # For ALB
321323 "user_security_group" : self .security_group_ids [0 ] if self .security_group_ids else "" ,
322-
323324 # Database configuration
324325 "db_instance_class" : self .db_instance_class ,
325326 "db_multi_az" : False , # Single-AZ for testing
326327 "db_deletion_protection" : False , # Allow deletion for testing
327-
328328 # ElasticSearch configuration
329329 "search_instance_type" : self .search_instance_type ,
330330 "search_instance_count" : 1 , # Single node for testing
331331 "search_volume_size" : self .search_volume_size ,
332332 "search_dedicated_master_enabled" : False ,
333333 "search_zone_awareness_enabled" : False ,
334-
335334 # CloudFormation parameters (required + optional)
336335 "parameters" : {
337336 ** self .get_required_cfn_parameters (),
338337 ** self .get_optional_cfn_parameters (),
339- }
338+ },
340339 }
341340
342341 # Add external IAM configuration if applicable
@@ -417,9 +416,7 @@ def to_terraform_vars(self) -> Dict[str, Any]:
417416 else :
418417 vars_dict ["iam_template_url" ] = self .iam_template_url
419418
420- vars_dict ["template_url" ] = (
421- self .app_template_url or self ._default_app_template_url ()
422- )
419+ vars_dict ["template_url" ] = self .app_template_url or self ._default_app_template_url ()
423420 else :
424421 vars_dict ["template_url" ] = self ._default_monolithic_template_url ()
425422
@@ -464,11 +461,13 @@ def get_template_files(self) -> Dict[str, str]:
464461 prefix = Path (self .template_prefix )
465462
466463 if self .pattern == "external-iam" :
464+ # Upload stable-iam.yaml as quilt-iam.yaml and stable-app.yaml as quilt-app.yaml
467465 return {
468- str (prefix ) + "-iam.yaml" : TEMPLATE_IAM ,
469- str (prefix ) + "-app.yaml" : TEMPLATE_APP ,
466+ str (prefix ) + "-iam.yaml" : "quilt-iam.yaml" ,
467+ str (prefix ) + "-app.yaml" : "quilt-app.yaml" ,
470468 }
471469 else :
470+ # Upload stable.yaml as quilt.yaml (or keep as quilt-monolithic.yaml)
472471 return {
473- str (prefix ) + ".yaml" : TEMPLATE_MONOLITHIC ,
472+ str (prefix ) + ".yaml" : "quilt.yaml" ,
474473 }
0 commit comments