Skip to content

Commit 43242bb

Browse files
authored
Merge pull request hashicorp#13140 from hashicorp/b-rds-snapshot-restore-db-name
provider/aws: Don't set DBName on `aws_db_instance` from snapshot
2 parents 3456f12 + 4619897 commit 43242bb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎builtin/providers/aws/resource_aws_db_instance.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,14 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
407407
}
408408

409409
if attr, ok := d.GetOk("name"); ok {
410-
opts.DBName = aws.String(attr.(string))
410+
// "Note: This parameter [DBName] doesn't apply to the MySQL, PostgreSQL, or MariaDB engines."
411+
// https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceFromDBSnapshot.html
412+
switch strings.ToLower(d.Get("engine").(string)) {
413+
case "mysql", "postgres", "mariadb":
414+
// skip
415+
default:
416+
opts.DBName = aws.String(attr.(string))
417+
}
411418
}
412419

413420
if attr, ok := d.GetOk("availability_zone"); ok {

0 commit comments

Comments
 (0)