From 908fa86b7f359489d2cfcd4706734807c2484b5d Mon Sep 17 00:00:00 2001 From: Edward Keeble Date: Wed, 10 May 2023 16:38:49 -0300 Subject: [PATCH] Allow passing a subnet selection instead of a subnet type to the create_database_server function --- .vscode/settings.json | 15 +++++++++------ VERSION | 2 +- cdk_bootstrapped_db/helpers.py | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 5170747..bc741d3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,10 @@ { - "python.analysis.diagnosticMode": "workspace", - "python.analysis.typeCheckingMode": "basic", - "python.formatting.provider": "black", - "python.testing.pytestEnabled": true, - "editor.formatOnSave": true -} \ No newline at end of file + "python.analysis.diagnosticMode": "workspace", + "python.analysis.typeCheckingMode": "basic", + "python.formatting.provider": "black", + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter" + } +} diff --git a/VERSION b/VERSION index afaf360..359a5b9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0 \ No newline at end of file +2.0.0 \ No newline at end of file diff --git a/cdk_bootstrapped_db/helpers.py b/cdk_bootstrapped_db/helpers.py index a9631f9..2548f6a 100644 --- a/cdk_bootstrapped_db/helpers.py +++ b/cdk_bootstrapped_db/helpers.py @@ -9,7 +9,7 @@ def create_database_server( scope: Construct, id: str, vpc: ec2.IVpc, - subnet_type: ec2.SubnetType, + subnet_selection: ec2.SubnetSelection, deletion_protect: bool, db_name: Optional[str] = None, db_snapshot_arn: Optional[str] = None, @@ -38,7 +38,7 @@ def create_database_server( "instance_identifier": "-".join( [v for v in [Stack.of(scope).stack_name, identifier] if v] ), - "vpc_subnets": {"subnet_type": subnet_type}, + "vpc_subnets": subnet_selection, "deletion_protection": deletion_protect, "removal_policy": ( RemovalPolicy.SNAPSHOT if deletion_protect else RemovalPolicy.DESTROY