-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(secretsmanager/rds): support credential rotation (#2052)
Add construct for rotation schedule, secret target attachment and RDS rotation single user.
- Loading branch information
Showing
19 changed files
with
1,816 additions
and
16 deletions.
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
Oops, something went wrong.