cdk-factory 0.20.5__py3-none-any.whl → 0.21.1__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.
- cdk_factory/configurations/resources/rds.py +17 -8
- cdk_factory/stack_library/rds/rds_stack.py +15 -13
- cdk_factory/version.py +1 -1
- {cdk_factory-0.20.5.dist-info → cdk_factory-0.21.1.dist-info}/METADATA +1 -1
- {cdk_factory-0.20.5.dist-info → cdk_factory-0.21.1.dist-info}/RECORD +8 -8
- {cdk_factory-0.20.5.dist-info → cdk_factory-0.21.1.dist-info}/WHEEL +0 -0
- {cdk_factory-0.20.5.dist-info → cdk_factory-0.21.1.dist-info}/entry_points.txt +0 -0
- {cdk_factory-0.20.5.dist-info → cdk_factory-0.21.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -27,14 +27,16 @@ class RdsConfig(EnhancedBaseConfig):
|
|
|
27
27
|
self.__deployment = deployment
|
|
28
28
|
|
|
29
29
|
@property
|
|
30
|
-
def
|
|
30
|
+
def default_database_name(self) -> str:
|
|
31
31
|
"""RDS instance name"""
|
|
32
32
|
return self.__config.get("name", self.database_name)
|
|
33
33
|
|
|
34
34
|
@property
|
|
35
|
-
def
|
|
35
|
+
def instance_identifier(self) -> str:
|
|
36
36
|
"""RDS DB instance identifier (sanitized)"""
|
|
37
|
-
raw_id = self.__config.get("
|
|
37
|
+
raw_id = self.__config.get("instance_identifier")
|
|
38
|
+
if not raw_id:
|
|
39
|
+
raise ValueError("No instance identifier found. Please add the instance identifier to the config.")
|
|
38
40
|
return self._sanitize_instance_identifier(raw_id)
|
|
39
41
|
|
|
40
42
|
def _sanitize_instance_identifier(self, identifier: str) -> str:
|
|
@@ -118,15 +120,22 @@ class RdsConfig(EnhancedBaseConfig):
|
|
|
118
120
|
return self.__config.get("instance_class", "t3.micro")
|
|
119
121
|
|
|
120
122
|
@property
|
|
121
|
-
def database_name(self) -> str:
|
|
122
|
-
"""
|
|
123
|
-
|
|
123
|
+
def database_name(self) -> str | None:
|
|
124
|
+
"""
|
|
125
|
+
Name of the database to create (sanitized for RDS requirements)
|
|
126
|
+
Optional and not required
|
|
127
|
+
"""
|
|
128
|
+
raw_name = self.__config.get("database_name")
|
|
129
|
+
if not raw_name:
|
|
130
|
+
return None
|
|
124
131
|
return self._sanitize_database_name(raw_name)
|
|
125
132
|
|
|
126
133
|
@property
|
|
127
|
-
def
|
|
134
|
+
def master_username(self) -> str:
|
|
128
135
|
"""Master username for the database (sanitized for RDS requirements)"""
|
|
129
|
-
raw_username = self.__config.get("
|
|
136
|
+
raw_username = self.__config.get("master_username")
|
|
137
|
+
if not raw_username:
|
|
138
|
+
raise ValueError("No master username found. Please add the master username to the config.")
|
|
130
139
|
return self._sanitize_username(raw_username)
|
|
131
140
|
|
|
132
141
|
@property
|
|
@@ -67,14 +67,16 @@ class RdsStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
67
67
|
self.workload = workload
|
|
68
68
|
|
|
69
69
|
self.rds_config = RdsConfig(stack_config.dictionary.get("rds", {}), deployment)
|
|
70
|
-
|
|
70
|
+
# Use stable construct ID to prevent CloudFormation logical ID changes on pipeline rename
|
|
71
|
+
# The construct ID determines the CloudFormation logical ID, not the physical resource names
|
|
72
|
+
instance_identifier = self.rds_config.instance_identifier
|
|
71
73
|
|
|
72
74
|
# Setup standardized SSM integration
|
|
73
75
|
self.setup_ssm_integration(
|
|
74
76
|
scope=self,
|
|
75
77
|
config=self.rds_config,
|
|
76
78
|
resource_type="rds",
|
|
77
|
-
resource_name=
|
|
79
|
+
resource_name=instance_identifier,
|
|
78
80
|
deployment=deployment,
|
|
79
81
|
workload=workload
|
|
80
82
|
)
|
|
@@ -87,15 +89,15 @@ class RdsStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
87
89
|
|
|
88
90
|
# Create RDS instance or import existing
|
|
89
91
|
if self.rds_config.existing_instance_id:
|
|
90
|
-
self.db_instance = self._import_existing_db(
|
|
92
|
+
self.db_instance = self._import_existing_db(instance_identifier)
|
|
91
93
|
else:
|
|
92
|
-
self.db_instance = self._create_db_instance(
|
|
94
|
+
self.db_instance = self._create_db_instance(instance_identifier, instance_identifier)
|
|
93
95
|
|
|
94
96
|
# Add outputs
|
|
95
|
-
self._add_outputs(
|
|
97
|
+
self._add_outputs(instance_identifier)
|
|
96
98
|
|
|
97
99
|
# Export to SSM Parameter Store
|
|
98
|
-
self._export_ssm_parameters(
|
|
100
|
+
self._export_ssm_parameters(instance_identifier)
|
|
99
101
|
|
|
100
102
|
@property
|
|
101
103
|
def vpc(self) -> ec2.IVpc:
|
|
@@ -162,7 +164,7 @@ class RdsStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
162
164
|
else:
|
|
163
165
|
raise ValueError("No subnets available in VPC for RDS instance")
|
|
164
166
|
|
|
165
|
-
def _create_db_instance(self, db_name: str) -> rds.DatabaseInstance:
|
|
167
|
+
def _create_db_instance(self, db_name: str, stable_db_id: str) -> rds.DatabaseInstance:
|
|
166
168
|
"""Create a new RDS instance"""
|
|
167
169
|
# Configure subnet group
|
|
168
170
|
# If we have subnet IDs from SSM, create a DB subnet group explicitly
|
|
@@ -232,7 +234,7 @@ class RdsStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
232
234
|
"vpc": self.vpc,
|
|
233
235
|
"instance_type": instance_type,
|
|
234
236
|
"credentials": rds.Credentials.from_generated_secret(
|
|
235
|
-
username=self.rds_config.
|
|
237
|
+
username=self.rds_config.master_username,
|
|
236
238
|
secret_name=self.rds_config.secret_name,
|
|
237
239
|
),
|
|
238
240
|
"database_name": self.rds_config.database_name,
|
|
@@ -264,7 +266,7 @@ class RdsStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
264
266
|
else:
|
|
265
267
|
db_props["vpc_subnets"] = subnets
|
|
266
268
|
|
|
267
|
-
db_instance = rds.DatabaseInstance(self,
|
|
269
|
+
db_instance = rds.DatabaseInstance(self, stable_db_id, **db_props)
|
|
268
270
|
|
|
269
271
|
# Add tags
|
|
270
272
|
for key, value in self.rds_config.tags.items():
|
|
@@ -320,15 +322,15 @@ class RdsStack(IStack, VPCProviderMixin, StandardizedSsmMixin):
|
|
|
320
322
|
logger.info(f"Exported SSM parameter: {ssm_exports['db_port']}")
|
|
321
323
|
|
|
322
324
|
# Export database name
|
|
323
|
-
if "
|
|
325
|
+
if "db_instance_identifier" in ssm_exports and self.rds_config.instance_identifier:
|
|
324
326
|
self.export_ssm_parameter(
|
|
325
327
|
scope=self,
|
|
326
328
|
id="SsmExportDbName",
|
|
327
|
-
value=self.rds_config.
|
|
328
|
-
parameter_name=ssm_exports["
|
|
329
|
+
value=self.rds_config.instance_identifier,
|
|
330
|
+
parameter_name=ssm_exports["db_instance_identifier"],
|
|
329
331
|
description=f"RDS database name for {db_name}",
|
|
330
332
|
)
|
|
331
|
-
logger.info(f"Exported SSM parameter: {ssm_exports['
|
|
333
|
+
logger.info(f"Exported SSM parameter: {ssm_exports['db_instance_identifier']}")
|
|
332
334
|
|
|
333
335
|
# Export secret ARN (contains username and password)
|
|
334
336
|
if "db_secret_arn" in ssm_exports:
|
cdk_factory/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.21.1"
|
|
@@ -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=
|
|
5
|
+
cdk_factory/version.py,sha256=SgjjYIjRx1j_wfbQTv5G4w3woiZ-Jp6WCRh6Z-HHPxc,23
|
|
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=eJ3Pl3GWk1jVr_bYQaaWlw4_-ZiFGaiXllI_fOOX1i0,9323
|
|
@@ -40,7 +40,7 @@ cdk_factory/configurations/resources/lambda_layers.py,sha256=gVeP_-LC3Eq0lkPaG_J
|
|
|
40
40
|
cdk_factory/configurations/resources/lambda_triggers.py,sha256=MD7cdMNKEulNBhtMLIFnWJuJ5R-yyIqa0LHUgbSQerA,834
|
|
41
41
|
cdk_factory/configurations/resources/load_balancer.py,sha256=P-jKemIjIWWqScmQKspmRy1m3BrwNkRtTNHDStOAJds,5617
|
|
42
42
|
cdk_factory/configurations/resources/monitoring.py,sha256=CPYWbUbWQzoPqDhdPiB4Vahq-pPi6BEkavkVohadSIo,2422
|
|
43
|
-
cdk_factory/configurations/resources/rds.py,sha256=
|
|
43
|
+
cdk_factory/configurations/resources/rds.py,sha256=fK2_GBIlVEF_I0Q73EaCz5AIuaTDIn2YQk-WcV-vf6s,16329
|
|
44
44
|
cdk_factory/configurations/resources/resource_mapping.py,sha256=cwv3n63RJ6E59ErsmSTdkW4i-g8huhHtKI0ExbRhJxA,2182
|
|
45
45
|
cdk_factory/configurations/resources/resource_naming.py,sha256=VE9S2cpzp11qqPL2z1sX79wXH0o1SntO2OG74nEmWC8,5508
|
|
46
46
|
cdk_factory/configurations/resources/resource_types.py,sha256=1WQHyDoErb-M-tETZZzyLDtbq_jdC85-I403dM48pgE,2317
|
|
@@ -114,7 +114,7 @@ cdk_factory/stack_library/load_balancer/load_balancer_stack.py,sha256=iR-l5ujLS4
|
|
|
114
114
|
cdk_factory/stack_library/monitoring/__init__.py,sha256=k1G_KDx47Aw0UugaL99PN_TKlyLK4nkJVApCaAK7GJg,153
|
|
115
115
|
cdk_factory/stack_library/monitoring/monitoring_stack.py,sha256=N_1YvEXE7fboH_S3kv_dSKZsufxMuPdFMjGzlNFpuSo,19283
|
|
116
116
|
cdk_factory/stack_library/rds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
117
|
-
cdk_factory/stack_library/rds/rds_stack.py,sha256=
|
|
117
|
+
cdk_factory/stack_library/rds/rds_stack.py,sha256=UwLaDpyNNvPnMV8DfZon8fyusuGkvcpJiUB5V3Gjrt4,14748
|
|
118
118
|
cdk_factory/stack_library/route53/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
119
119
|
cdk_factory/stack_library/route53/route53_stack.py,sha256=PaYpVVYC_jZ-pbsmK0vW_OVleJ4En0L2O_a92jlWi18,16601
|
|
120
120
|
cdk_factory/stack_library/rum/__init__.py,sha256=gUrWQdzd4rZ2J0YzAQC8PsEGAS7QgyYjB2ZCUKWasy4,90
|
|
@@ -143,8 +143,8 @@ cdk_factory/utilities/os_execute.py,sha256=5Op0LY_8Y-pUm04y1k8MTpNrmQvcLmQHPQITE
|
|
|
143
143
|
cdk_factory/utils/api_gateway_utilities.py,sha256=If7Xu5s_UxmuV-kL3JkXxPLBdSVUKoLtohm0IUFoiV8,4378
|
|
144
144
|
cdk_factory/validation/config_validator.py,sha256=Pb0TkLiPFzUplBOgMorhRCVm08vEzZhRU5xXCDTa5CA,17602
|
|
145
145
|
cdk_factory/workload/workload_factory.py,sha256=yDI3cRhVI5ELNDcJPLpk9UY54Uind1xQoV3spzT4z7E,6068
|
|
146
|
-
cdk_factory-0.
|
|
147
|
-
cdk_factory-0.
|
|
148
|
-
cdk_factory-0.
|
|
149
|
-
cdk_factory-0.
|
|
150
|
-
cdk_factory-0.
|
|
146
|
+
cdk_factory-0.21.1.dist-info/METADATA,sha256=9FoDlo8hg9_wGFmPmaVmnEQUO_Os-We2cYJgCiWSKZ4,2451
|
|
147
|
+
cdk_factory-0.21.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
148
|
+
cdk_factory-0.21.1.dist-info/entry_points.txt,sha256=S1DPe0ORcdiwEALMN_WIo3UQrW_g4YdQCLEsc_b0Swg,53
|
|
149
|
+
cdk_factory-0.21.1.dist-info/licenses/LICENSE,sha256=NOtdOeLwg2il_XBJdXUPFPX8JlV4dqTdDGAd2-khxT8,1066
|
|
150
|
+
cdk_factory-0.21.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|