Skip to content

Commit

Permalink
Fix and simplify resolve Sub
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPreston committed Nov 14, 2023
1 parent 9c5c2a0 commit 92184be
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions ecs_composex/rds_resources_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,42 +241,36 @@ def generate_secret_string(
f"{db.logical_name}ConnectionStringSecret",
Description=Sub(f"Connection string secret for {db.logical_name}"),
SecretString=Sub(
"${ENGINE}://${USERNAME}:${PASSWORD}@{HOST}:${PORT}/${DBNAME}",
"${ENGINE}://${USERNAME}:${PASSWORD}@${HOST}:${PORT}/${DBNAME}",
ENGINE=Sub(
"{{resolve:secretsmanager:"
+ "${SECRET_SOURCE}"
+ ":SecretString:engine",
SECRET_SOURCE=secret_import,
+ f"${{{secret_import.title}}}"
+ ":SecretString:engine}}",
),
USERNAME=Sub(
"{{resolve:secretsmanager:"
+ "${SECRET_SOURCE}"
+ ":SecretString:username",
SECRET_SOURCE=secret_import,
+ f"${{{secret_import.title}}}"
+ ":SecretString:username}}",
),
PASSWORD=Sub(
"{{resolve:secretsmanager:"
+ "${SECRET_SOURCE}"
+ ":SecretString:password",
SECRET_SOURCE=secret_import,
+ f"${{{secret_import.title}}}"
+ ":SecretString:password}}",
),
HOST=Sub(
"{{resolve:secretsmanager:"
+ "${SECRET_SOURCE}"
+ ":SecretString:host",
SECRET_SOURCE=secret_import,
+ f"${{{secret_import.title}}}"
+ ":SecretString:host}}",
),
PORT=Sub(
"{{resolve:secretsmanager:"
+ "${SECRET_SOURCE}"
+ ":SecretString:port",
SECRET_SOURCE=secret_import,
+ f"${{{secret_import.title}}}"
+ ":SecretString:port}}",
),
DBNAME=Sub(
"{{resolve:secretsmanager:"
+ "${SECRET_SOURCE}"
+ ":SecretString:dbname",
SECRET_SOURCE=secret_import,
+ f"${{{secret_import.title}}}"
+ ":SecretString:dbname}}",
),
),
),
Expand Down

0 comments on commit 92184be

Please sign in to comment.