https://pulumi.com logo
#general
Title
# general
m

many-house-85254

11/24/2023, 7:36 PM
Is it possible to create a RDS instance and RDS proxy at the same time in Pulumi? I ask because RDS proxy requires a secret, whose values are not known. Example code;
Copy code
from pulumi_aws.rds import Instance, Proxy, ProxyArgs, ProxyAuthArgs
from aws.secretsmanager import create_secret
from json import dumps

rds = Instance(name,
                   db_name=name,
                   engine=engine,
                   engine_version=engine_version,
                   allocated_storage=storage,
                   instance_class=instance_class,
                   username=username,
                   password=password,
                   skip_final_snapshot=True,
                   publicly_accessible=False,
                   opts=opts
                   )

secret = dumps({"username": rds.username, "password": rds.password, "engine": rds.engine, "host": rds.endpoint,
              "port": rds.port})

proxy = Proxy(f"{name}-proxy",
                  engine_family=engine.upper(),
                  auths=[ProxyAuthArgs(
                      auth_scheme="SECRETS",
                      iam_auth="DISABLED",
                      secret_arn=secret.arn,
                      username=username
                  )],
                  opts=opts
                  )