-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(secretsmanager/rds): support credential rotation #2052
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0a39df7
feat(secretsmanager): add construct for RDS rotation single user
jogold 1f1742b
Use a IConnectable for rds rotation
jogold bce6128
Replace SecretTargetAttachment by AttachedSecret
jogold 81f2c5b
Move rds rotation to aws-rds
jogold 6554f2f
Implement ISecretAttachmentTarget for cluster
jogold 2a99fb4
Update secretsmanager README
jogold 87cf249
Add secret and rotation to cluster
jogold d16eaa2
Add integration tests for cluster rotation
jogold e381a81
Update README for aws-rds
jogold e2b9f13
Typo
jogold f014a07
Fix dependencies
jogold 9aa5fe7
Rename test
jogold f4b4403
Remove default username in DatabaseSecret
jogold 304c1d5
Fix typos
jogold ea1a32e
Merge branch 'master' into secret-rotation
jogold df59fca
Update README for aws-rds
jogold fdb3236
Move literal example to new line
rix0rrr 312d551
Merge branch 'master' into secret-rotation
jogold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import kms = require('@aws-cdk/aws-kms'); | ||
import secretsmanager = require('@aws-cdk/aws-secretsmanager'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
|
||
/** | ||
* Construction properties for a DatabaseSecret. | ||
*/ | ||
export interface DatabaseSecretProps { | ||
/** | ||
* The username. | ||
*/ | ||
username: string; | ||
|
||
/** | ||
* The KMS key to use to encrypt the secret. | ||
* | ||
* @default default master key | ||
*/ | ||
encryptionKey?: kms.IEncryptionKey; | ||
} | ||
|
||
/** | ||
* A database secret. | ||
*/ | ||
export class DatabaseSecret extends secretsmanager.Secret { | ||
constructor(scope: cdk.Construct, id: string, props: DatabaseSecretProps) { | ||
super(scope, id, { | ||
encryptionKey: props.encryptionKey, | ||
generateSecretString: ({ | ||
passwordLength: 30, // Oracle password cannot have more than 30 characters | ||
secretStringTemplate: JSON.stringify({ username: props.username }), | ||
generateStringKey: 'password', | ||
excludeCharacters: '"@/\\' | ||
}) as secretsmanager.TemplatedSecretStringGenerator | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import ec2 = require('@aws-cdk/aws-ec2'); | ||
import kms = require('@aws-cdk/aws-kms'); | ||
|
||
/** | ||
* The engine for the database cluster | ||
|
@@ -69,10 +70,18 @@ export interface Login { | |
/** | ||
* Password | ||
* | ||
* Do not put passwords in your CDK code directly. Import it from a Stack | ||
* Parameter or the SSM Parameter Store instead. | ||
* Do not put passwords in your CDK code directly. | ||
* | ||
* @default a Secrets Manager generated password | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. <3 |
||
*/ | ||
password?: string; | ||
|
||
/** | ||
* KMS encryption key to encrypt the generated secret. | ||
* | ||
* @default default master key | ||
*/ | ||
password: string; | ||
kmsKey?: kms.IEncryptionKey; | ||
} | ||
|
||
/** | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3