Skip to content

Commit

Permalink
Merge pull request #35589 from kolvin/b/trigger-subequent-instance-up…
Browse files Browse the repository at this point in the history
…date-for-pitr-password

fix(rds): trigger subsequent instance update operation for PITR case masterUserPassword
  • Loading branch information
ewbankkit authored Feb 6, 2024
2 parents e49b3e1 + d5611d3 commit 9011515
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/35589.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_db_instance: Creating resource from point-in-time recovery now handles `password` attribute correctly
```
17 changes: 11 additions & 6 deletions internal/service/rds/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,8 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in
var diags diag.Diagnostics
conn := meta.(*conns.AWSClient).RDSConn(ctx)

// Some API calls (e.g. CreateDBInstanceReadReplica and
// RestoreDBInstanceFromDBSnapshot do not support all parameters to
// Some API calls (e.g. CreateDBInstanceReadReplica, RestoreDBInstanceFromDBSnapshot
// RestoreDBInstanceToPointInTime do not support all parameters to
// correctly apply all settings in one pass. For missing parameters or
// unsupported configurations, we may need to call ModifyDBInstance
// afterwards to prevent Terraform operators from API errors or needing
Expand Down Expand Up @@ -980,14 +980,14 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in
input.OptionGroupName = aws.String(v.(string))
}

if v, ok := d.GetOk("password"); ok {
input.MasterUserPassword = aws.String(v.(string))
}

if v, ok := d.GetOk("parameter_group_name"); ok {
input.DBParameterGroupName = aws.String(v.(string))
}

if v, ok := d.GetOk("password"); ok {
input.MasterUserPassword = aws.String(v.(string))
}

if v, ok := d.GetOk("performance_insights_enabled"); ok {
input.EnablePerformanceInsights = aws.Bool(v.(bool))
}
Expand Down Expand Up @@ -1432,6 +1432,11 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in
input.DBParameterGroupName = aws.String(v.(string))
}

if v, ok := d.GetOk("password"); ok {
modifyDbInstanceInput.MasterUserPassword = aws.String(v.(string))
requiresModifyDbInstance = true
}

if v, ok := d.GetOk("port"); ok {
input.Port = aws.Int64(int64(v.(int)))
}
Expand Down

0 comments on commit 9011515

Please sign in to comment.