-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
aws_rds: DatabaseInstance credentials
doesn't accept dict
in Python
#30514
Comments
Alternatively, improve the documentation by removing the # ...
credentials=rds.Credentials.from_secret(templated_secret)
# ... |
Hi @andrewvaughan , thanks for reaching out. Could you please try doing this way and see if it works as I noticed that the fromSecert() uses Secret object and username which works like this -
code change - credentials= rds.Credentials.from_secret(secret01, "username"), Sharing the synthesized template snippet - {
"Resources": {
"AuroraSecret41E6E877": {
"Type": "AWS::SecretsManager::Secret",
"Properties": {
"Description": {
"Fn::Join": [
"",
[
"Generated by the CDK for stack: ",
{
"Ref": "AWS::StackName"
}
]
]
},
"GenerateSecretString": {
"ExcludeCharacters": " %+~`#$&*()|[]{}:;<>?!'/@\"\\",
"GenerateStringKey": "password",
"PasswordLength": 30,
"SecretStringTemplate": "{\"username\":\"clusteradmin\"}"
}
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete",
"Metadata": {
"aws:cdk:path": "RdscredsissueStack/AuroraSecret/Resource"
}
}, Also I tried to repro in typescript to see if dict is accepted and its successful there as well - const cluster = new rds.DatabaseCluster(this, 'AuroraClusterV2', {
engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_15_5 }),
credentials: { username: 'clusteradmin'},
clusterIdentifier: 'db-endpoint-test',
writer: rds.ClusterInstance.serverlessV2('writer'),
serverlessV2MinCapacity: 2,
serverlessV2MaxCapacity: 10,
vpc,
defaultDatabaseName: 'demos',
enableDataApi: true, // has to be set to true to enable Data API as not enable by default
}); Please feel free to correct if something is misinterpreted. |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Describe the bug
Per the Python documentation:
https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_rds/DatabaseInstance.html
However, the example immediately preceding shows a dictionary being used to involve template secrets:
And the code will fail if a
dict
is used, as shown. Either the documentation should be updated to remove the invalid example, or (recommended) thecredentials
variable should be updated to accept adict
.Expected Behavior
A
dict
should be accepted for thecredentials
parameter ofDatabaseInstance
.Current Behavior
Reproduction Steps
Copy and paste the example from the documentation.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.145.0 (build fdf53ba)
Framework Version
No response
Node.js Version
Node.js v22.2.0
OS
macOS
Language
Python
Language Version
Python 3.12.0
Other information
No response
The text was updated successfully, but these errors were encountered: