@@ -62,10 +62,14 @@ export namespace Database {
6262 */
6363 autoMinorVersionUpgrade ?: pulumi . Input < boolean > ;
6464 /**
65- * The name of custom aws.rds.ParameterGroup. Setting this param will apply custom
65+ * The name of existing custom aws.rds.ParameterGroup. Setting this param will apply custom
6666 * DB parameters to this instance.
6767 */
6868 parameterGroupName ?: pulumi . Input < string > ;
69+ /**
70+ * Arguments for creation of new custom aws.rds.ParameterGroup.
71+ */
72+ parameterGroupArgs ?: pulumi . Input < aws . rds . ParameterGroupArgs > ;
6973 /**
7074 * Set this to `{ enabled: true }` to enable low-downtime updates using RDS Blue/Green deployments.
7175 * Defaults to `{ enabled: false }`.
@@ -115,6 +119,7 @@ export class Database extends pulumi.ComponentResource {
115119 password : Password ;
116120 encryptedSnapshotCopy ?: aws . rds . SnapshotCopy ;
117121 monitoringRole ?: aws . iam . Role ;
122+ parameterGroup ?: pulumi . Output < aws . rds . ParameterGroup > ;
118123
119124 constructor (
120125 name : string ,
@@ -129,6 +134,7 @@ export class Database extends pulumi.ComponentResource {
129134 const {
130135 enableMonitoring,
131136 snapshotIdentifier,
137+ parameterGroupArgs,
132138 } = argsWithDefaults ;
133139
134140 const vpc = pulumi . output ( argsWithDefaults . vpc ) ;
@@ -148,6 +154,9 @@ export class Database extends pulumi.ComponentResource {
148154 this . encryptedSnapshotCopy =
149155 this . createEncryptedSnapshotCopy ( snapshotIdentifier ) ;
150156 }
157+ if ( parameterGroupArgs ) {
158+ this . parameterGroup = this . createParameterGroup ( parameterGroupArgs ) ;
159+ }
151160 this . instance = this . createDatabaseInstance ( args ) ;
152161
153162 this . registerOutputs ( ) ;
@@ -248,6 +257,18 @@ export class Database extends pulumi.ComponentResource {
248257 return encryptedSnapshotCopy ;
249258 }
250259
260+ private createParameterGroup (
261+ parameterGroupArgs : pulumi . Input < aws . rds . ParameterGroupArgs >
262+ ) {
263+ return pulumi . output ( parameterGroupArgs ) . apply ( args => {
264+ return new aws . rds . ParameterGroup (
265+ `${ this . name } -parameter-group` ,
266+ args ,
267+ { parent : this }
268+ ) ;
269+ } )
270+ }
271+
251272 private createDatabaseInstance ( args : Database . Args ) {
252273 const argsWithDefaults = Object . assign ( { } , defaults , args ) ;
253274 const stack = pulumi . getStack ( ) ;
@@ -262,6 +283,10 @@ export class Database extends pulumi.ComponentResource {
262283 }
263284 : { } ;
264285
286+ const parameterGroupName = this . parameterGroup
287+ ? this . parameterGroup . name
288+ : argsWithDefaults . parameterGroupName ;
289+
265290 const instance = new aws . rds . Instance (
266291 `${ this . name } -rds` ,
267292 {
@@ -288,7 +313,7 @@ export class Database extends pulumi.ComponentResource {
288313 backupWindow : '06:00-06:30' ,
289314 backupRetentionPeriod : 14 ,
290315 caCertIdentifier : 'rds-ca-rsa2048-g1' ,
291- parameterGroupName : argsWithDefaults . parameterGroupName ,
316+ parameterGroupName,
292317 allowMajorVersionUpgrade : argsWithDefaults . allowMajorVersionUpgrade ,
293318 blueGreenUpdate : argsWithDefaults . blueGreenUpdate ,
294319 snapshotIdentifier :
0 commit comments